GarageCarLineWindowV4.cs(471,72): error CS1003: Syntax error, ',' expected
GarageCarLineWindowV4.cs(471,73): error CS1002: ; expected
GarageCarLineWindowV4.cs(482,72): error CS1003: Syntax error, ',' expected
GarageCarLineWindowV4.cs(482,73): error CS1002: ; expected
GarageCarLineWindowV4.cs(484,72): error CS1003: Syntax error, ',' expected
GarageCarLineWindowV4.cs(484,73): error CS1002: ; expected
скрипт:
Синтаксис:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using GlobalSequence;
- using UnityEngine;
- public class GarageCarLineWindowV4 : TForm
- {
- public static GarageCarLineWindowV4 instance
- {
- get
- {
- if (GarageCarLineWindowV4._instance == null)
- {
- GarageCarLineWindowV4._instance = new GarageCarLineWindowV4();
- GarageCarLineWindowV4._instance.LoadFromXML("GarageCarLineWindowV4");
- }
- return GarageCarLineWindowV4._instance;
- }
- }
- private void ClearCarLineDrawers()
- {
- this.carTypeLineDictionary.Values.ToList<List<IGarageCarLineDrawer>>().ForEach(delegate(List<IGarageCarLineDrawer> x)
- {
- x.Clear();
- });
- }
- private List<IGarageCarLineDrawer> GetCarLineDrawersByType(ServerDictionaries.ECarTypeIdEntity type)
- {
- return (!this.carTypeLineDictionary.ContainsKey(type)) ? null : this.carTypeLineDictionary[type];
- }
- private void SortCarLineDrawers()
- {
- foreach (List<IGarageCarLineDrawer> list in this.carTypeLineDictionary.Values)
- {
- list.Sort(new Comparison<IGarageCarLineDrawer>(GarageCarLineWindowV4.SortCarLineComparision));
- }
- }
- private static int SortCarLineComparision(IGarageCarLineDrawer x, IGarageCarLineDrawer y)
- {
- if (x == null)
- {
- return 0;
- }
- if (y == null)
- {
- return 0;
- }
- ShopItem shopItemOfCarByGOTypeId = ServerDictionariesManager.GetShopItemOfCarByGOTypeId(x.carDataInfo.carTypeEntityInstance.entityId);
- ShopItem shopItemOfCarByGOTypeId2 = ServerDictionariesManager.GetShopItemOfCarByGOTypeId(y.carDataInfo.carTypeEntityInstance.entityId);
- if (shopItemOfCarByGOTypeId == null || shopItemOfCarByGOTypeId2 == null)
- {
- return 0;
- }
- if (x is GarageDummyCarLineDrawer && !(y is GarageDummyCarLineDrawer))
- {
- return 1;
- }
- if (!(x is GarageDummyCarLineDrawer) && y is GarageDummyCarLineDrawer)
- {
- return -1;
- }
- if (!(x is GarageDummyCarLineDrawer))
- {
- return GarageCarLineWindowV4.CompareByGUIOrder(shopItemOfCarByGOTypeId, shopItemOfCarByGOTypeId2);
- }
- int userLevel = GamerController.gamer.UserExperience.GetUserLevel();
- if (shopItemOfCarByGOTypeId.RequiredUserLevel > userLevel && shopItemOfCarByGOTypeId2.RequiredUserLevel <= userLevel)
- {
- return 1;
- }
- if (shopItemOfCarByGOTypeId.RequiredUserLevel <= userLevel && shopItemOfCarByGOTypeId2.RequiredUserLevel > userLevel)
- {
- return -1;
- }
- return GarageCarLineWindowV4.CompareByGUIOrder(shopItemOfCarByGOTypeId, shopItemOfCarByGOTypeId2);
- }
- private static int CompareByGUIOrder(ShopItem x, ShopItem y)
- {
- if (x.GuiOrder > y.GuiOrder)
- {
- return -1;
- }
- if (x.GuiOrder < y.GuiOrder)
- {
- return 1;
- }
- return x.name.CompareTo(y.name);
- }
- public static void SetCarsInGarageLineWindow()
- {
- GarageCarLineWindowV4.instance.showedGarageCarLines.Clear();
- GarageCarLineWindowV4.instance.ClearCarLineDrawers();
- if (GamerController.gamer.UserCars == null)
- {
- CustomLogger.LogError("GarageCarLineWindowV4.SetCarsInGarageLineWindow: GamerController.gamer.UserCars == null!", string.Empty);
- return;
- }
- List<ShopItem> list = new List<ShopItem>();
- list.AddRange(ServerDictionariesManager.notPremiumCarsItems);
- list.AddRange(from x in ServerDictionariesManager.premiumCarsItems
- where GamerController.gamer.UserCars.IsCarExist(x.dictionaryItemId)
- select x);
- list.RemoveAll((ShopItem si) => GamerController.gamer.UserExperience.GetUserLevel() > si.MaxUserLevel && !GamerController.gamer.UserCars.IsCarExist(si.dictionaryItemId));
- foreach (ShopItem shopItem in list)
- {
- List<IGarageCarLineDrawer> carLineDrawersByType = GarageCarLineWindowV4.instance.GetCarLineDrawersByType(shopItem.CarType);
- if (carLineDrawersByType != null)
- {
- int count = carLineDrawersByType.Count;
- if (GamerController.gamer.UserCars.IsCarExist(shopItem.dictionaryItemId))
- {
- CarData carDataByModelId = GamerController.gamer.UserCars.GetCarDataByModelId(shopItem.dictionaryItemId);
- carLineDrawersByType.Add(new GarageCarLineDrawer(GarageCarLineButtonType.car, count, carDataByModelId));
- }
- else
- {
- carLineDrawersByType.Add(new GarageDummyCarLineDrawer(shopItem, count));
- }
- }
- }
- GarageCarLineWindowV4.instance.SortCarLineDrawers();
- }
- public static bool IsMouseOver
- {
- get
- {
- return GarageCarLineWindowV4.instance.isMouseOver;
- }
- }
- public void OnShowFunc(TForm form)
- {
- }
- public void OnCloseFunc(TForm form)
- {
- }
- public static bool IsVisible
- {
- get
- {
- return GarageCarLineWindowV4.instance.visible;
- }
- }
- public static Vector2 UpLeftRealCorner
- {
- get
- {
- if (GarageCarLineWindowV4.instance != null)
- {
- return new Vector2(GarageCarLineWindowV4.instance.formRect.x, GarageCarLineWindowV4.instance.formRect.y + GarageCarLineWindowV4.instance.formRect.height - (GarageCarLineWindowV4.instance.mount.controlRect.height - 30f));
- }
- return new Vector2(0f, 0f);
- }
- }
- public static Vector2 UpLeftCorner
- {
- get
- {
- if (GarageCarLineWindowV4.instance != null)
- {
- return new Vector2(GarageCarLineWindowV4.instance.formRect.x, GarageCarLineWindowV4.instance.formRect.y);
- }
- return new Vector2(0f, 0f);
- }
- }
- public static bool IsMouseOverCarBarControl
- {
- get
- {
- return GarageCarLineWindowV4.instance.carLineControl.mouseIsOverControl;
- }
- }
- public void OnXMLLoadedFunc(TForm form)
- {
- this.mount = base.ControlByName("mount");
- this.leftScrollButton = base.ControlByName("leftScrollButton");
- this.rightScrollButton = base.ControlByName("rightScrollButton");
- this.carLineControl = base.ControlByName("carLineControl");
- this.carLineExp = base.ControlByName("carLineExp");
- this.carLineName = base.ControlByName("carLineName");
- this.carEliteIcon = base.ControlByName("carEliteIcon");
- this.carLineInfo = base.ControlByName("carLineInfo");
- this.carRentTimer = base.ControlByName("carRentTimer");
- this.carLineBuyButtonRect = base.ControlByName("carLineBuyButtonRect");
- this.carLineWinX2Rect = base.ControlByName("carLineWinX2Rect");
- this.carLineReturnButtonRect = base.ControlByName("carLineReturnButtonRect");
- this.carLineBonusExpRect = base.ControlByName("carLineBonusExpRect");
- this.chatsBoxControl = base.ControlByName("chatsBoxControl");
- this.chatsBoxRewindButtonRect = base.ControlByName("chatsBoxRewindButtonRect");
- this.chatsBoxWindowButtonRect = base.ControlByName("chatsBoxWindowButtonRect");
- this.chatsBoxWindowsAreaRect = base.ControlByName("chatsBoxWindowsAreaRect");
- this.tabChatButton = base.ControlByName("tabChatButton");
- this.tabModeratorChatButton = base.ControlByName("tabModeratorChatButton");
- this.tabQuestsButton = base.ControlByName("tabQuestsButton");
- this.tabAchievementsButton = base.ControlByName("tabAchievementsButton");
- this.tabActionsButton = base.ControlByName("tabActionsButton");
- this.tabNewsButton = base.ControlByName("tabNewsButton");
- this.tabFriendsButton = base.ControlByName("tabFriendsButton");
- this.accordeonButton = base.ControlByName("accordeonButton");
- this.accordeonLeftLabel = base.ControlByName("accordeonLeftLabel");
- this.accordeonRightLabel = base.ControlByName("accordeonRightLabel");
- this.accordeonSign = base.ControlByName("accordeonSign");
- this.buyBackgroundRect = base.ControlByName("buyBackgroundRect");
- this.buyLabelRect = base.ControlByName("buyLabelRect");
- this.buyPriceRect = base.ControlByName("buyPriceRect");
- this.silverIconRect = base.ControlByName("silverIconRect");
- this.lockedLabelRect = base.ControlByName("lockedLabelRect");
- this.lockedPriceRect = base.ControlByName("lockedPriceRect");
- this.lockedIconRect = base.ControlByName("lockedIconRect");
- this.viewRectWidth = (float)Screen.width - 4f * this.accordeonButton.controlRect.width - 2f * GarageCarLineWindowV4.scrollButtonSize.x;
- GarageCarLineWindowV4.SetWindowGeometry(false);
- this.SetCarTypeLines();
- }
- private void SetCarTypeLines()
- {
- this.carTypeLineDictionary.Clear();
- foreach (object obj in Enum.GetValues(typeof(ServerDictionaries.ECarTypeIdEntity)))
- {
- ServerDictionaries.ECarTypeIdEntity key = (ServerDictionaries.ECarTypeIdEntity)((int)obj);
- this.carTypeLineDictionary.Add(key, new List<IGarageCarLineDrawer>());
- }
- }
- public static void ShowWindow(bool needScroll = false)
- {
- GUIMain.onScreenResolutionChanged += GarageCarLineWindowV4.OnScreenResolutionChanged;
- GamerController.gamer.UserCars.onCurrentCarChanged.onCustomEvent += GarageCarLineWindowV4.OnChangeCurrentCar;
- ShopController.OnBuyCar = (Action<NewCarProxy, DeltaMoney>)Delegate.Combine(ShopController.OnBuyCar, new Action<NewCarProxy, DeltaMoney>(GarageCarLineWindowV4.OnCarIsBought));
- GarageCarLineWindowV4.SetWindowGeometry(false);
- GarageCarLineWindowV4.OpenLeftPanel(GarageCarLineWindowV4.instance.currentLeftMode, true);
- GarageCarLineWindowV4.OpenRightPanel(GarageCarLineWindowV4.instance.currentRightMode, true);
- GarageCarLineWindowV4.SetCarsInGarageLineWindow();
- GarageCarLineWindowV4.instance.SetCurrent();
- if (needScroll)
- {
- GarageCarLineWindowV4.instance.ScrollToCurrentCar();
- }
- GarageCarLineWindowV4.instance.SetCarScrollButtons();
- GarageCarLineWindowV4.instance.Show();
- }
- private void ScrollToCurrentCar()
- {
- IGarageCarLineDrawer current = this.GetCurrent();
- if (current == null || current.carDataInfo == null || current.carDataInfo.carTypeEntityInstance == null)
- {
- return;
- }
- ServerDictionaries.ECarTypeIdEntity carTypeId = current.carDataInfo.carTypeEntityInstance.carTypeId;
- this.SetCarLineDrawersByType(carTypeId);
- CustomLogger.LogDebug("GarageCarLineWindowV4.ScrollToCurrentCar: " + carTypeId, string.Empty);
- }
- private static void SetCarLineMode()
- {
- if (GamerController.gamer.UserCars.CurrentCar != null)
- {
- GarageCarLineWindowV4.instance.currentSelectedCarType = GamerController.gamer.UserCars.CurrentCar.carTypeEntityInstance.carTypeId;
- }
- }
- private static void OnCarIsBought(NewCarProxy arg1, DeltaMoney arg2)
- {
- GarageCarLineWindowV4.instance.SetCurrent();
- }
- public static void HideWindow()
- {
- GUIMain.onScreenResolutionChanged -= GarageCarLineWindowV4.OnScreenResolutionChanged;
- GamerController.gamer.UserCars.onCurrentCarChanged.onCustomEvent -= GarageCarLineWindowV4.OnChangeCurrentCar;
- ShopController.OnBuyCar = (Action<NewCarProxy, DeltaMoney>)Delegate.Remove(ShopController.OnBuyCar, new Action<NewCarProxy, DeltaMoney>(GarageCarLineWindowV4.OnCarIsBought));
- GarageCarLineWindowV4.instance.OpenLeftPanelInternal(GarageCarLineWindowV4.instance.currentLeftMode, false, true);
- GarageCarLineWindowV4.instance.OpenRightPanelInternal(GarageCarLineWindowV4.instance.currentRightMode, false, true);
- GarageCarLineWindowV4.instance.Hide();
- }
- private static void OnScreenResolutionChanged(Vector2 resolution)
- {
- GarageCarLineWindowV4.SetWindowGeometry(false);
- GarageCarLineWindowV4.SetCarsInGarageLineWindow();
- GarageCarLineWindowV4.instance.SetCarScrollButtons();
- }
- private static void OnChangeCurrentCar()
- {
- GarageCarLineWindowV4.SetCarLineMode();
- GarageCarLineWindowV4.instance.SetCurrent();
- }
- private void SetWindowRect()
- {
- Rect baseRect = new Rect(GarageCarLineWindowV4.instance.baseRect.x, GarageCarLineWindowV4.instance.baseRect.y, (float)Screen.width, GarageCarLineWindowV4.instance.height);
- base.SetBaseRect(baseRect);
- this.mount.SetBaseRect(new Rect(0f, 0f, (float)Screen.width, this.mount.controlRect.height));
- this.carPanelRect.width = (float)Screen.width;
- this.carPanelRect.height = this.carLineControl.controlRect.height;
- this.countOfshowdButtons = Mathf.Max(0, Mathf.FloorToInt(this.viewRectWidth / (this.buttonSize.x + this.shiftBetweenCarButtons)));
- this.carLineControl.controlRect = this.carPanelRect;
- CustomLogger.LogInfo("carLineControl.controlRect " + this.carLineControl.controlRect.ToString(), string.Empty);
- CustomLogger.LogInfo("carPanelRect.width = " + this.carPanelRect.width.ToString(), string.Empty);
- CustomLogger.LogInfo("countOfshowdButtons = " + this.countOfshowdButtons.ToString(), string.Empty);
- }
- public static void SetWindowGeometry(bool changeMode = false)
- {
- GarageCarLineWindowV4.instance.SetWindowRect();
- }
- public void OnPaintGarageCarLineWindowV4(TForm form)
- {
- bool flag = !GarageSkinsWindowV3.IsVisible;
- this.DrawTabButtons(flag);
- this.DrawButtonFlash(NoticesController.HoverFloat, this.tabNewsButton.controlRect, flag);
- this.DrawButtonFlash(PromotionController.HoverFloat, this.tabActionsButton.controlRect, flag);
- this.DrawButtonFlash(UserMissions.HoverFloat, this.tabQuestsButton.controlRect, flag);
- }
- private void DrawButtonFlash(float value, Rect rect, bool visible)
- {
- if (!visible)
- {
- return;
- }
- if (value > 0f)
- {
- Color color = GUI.color;
- Color color2 = GUI.color;
- color2.a = value;
- GUI.color = color2;
- GUI.DrawTexture(rect, GarageCarLineWindowV4.flashIcon.icon);
- GUI.color = color;
- }
- }
- private Vector2 GetCurrentScrollPos()
- {
- return this.GetScrollPos(this.currentSelectedCarType);
- }
- private Vector2 GetScrollPos(ServerDictionaries.ECarTypeIdEntity carType)
- {
- if (GarageCarLineWindowV4.scrollsPos.ContainsKey(carType))
- {
- return GarageCarLineWindowV4.scrollsPos[carType];
- }
- GarageCarLineWindowV4.scrollsPos.Add(carType, this.DEFAULT_SCROLL_POS);
- return this.DEFAULT_SCROLL_POS;
- }
- private void SetScrollPos(ServerDictionaries.ECarTypeIdEntity carType, float x)
- {
- Vector2 scrollPos = this.GetScrollPos(carType);
- scrollPos.x = x;
- this.SetScrollPos(carType, scrollPos);
- }
- private void SetScrollPos(ServerDictionaries.ECarTypeIdEntity carType, Vector2 scrollPos)
- {
- if (GarageCarLineWindowV4.scrollsPos.ContainsKey(carType))
- {
- GarageCarLineWindowV4.scrollsPos[carType] = scrollPos;
- }
- else
- {
- GarageCarLineWindowV4.scrollsPos.Add(carType, scrollPos);
- }
- }
- public void OnPaintCarLineControl(object control)
- {
- if (!GlobalSequenceController.IsActive(GlobalStateIds.GARAGE))
- {
- return;
- }
- this.carLineControl.width = this.carPanelRect.width;
- this.UpdateChatsBoxStyles();
- Rect rect = new Rect(0f, 5f, this.buttonSize.x, this.buttonSize.y);
- if (GarageCarLineWindowV4.carScrollMoving)
- {
- this.SetScrollPos(this.currentSelectedCarType, GarageCarLineWindowV4.carScrollValue.value);
- TForm.HideTooltipsWindows(false);
- }
- int num = 0;
- foreach (ServerDictionaries.ECarTypeIdEntity carType in this.carTypeLineDictionary.Keys)
- {
- num++;
- bool carTypeChanged = false;
- this.DrawAccordeonButton(carType, ref rect, ref carTypeChanged);
- this.DrawCarsOfType(carType, num, ref rect, carTypeChanged);
- }
- }
- private void DrawAccordeonButton(ServerDictionaries.ECarTypeIdEntity carType, ref Rect _itemRect, ref bool carTypeChanged)
- {
- string buttonName = string.Empty;
- IconHolder emptyIcon = IconHolder.EmptyIcon;
- switch (carType)
- {
- case ServerDictionaries.ECarTypeIdEntity.SCOUT:
- buttonName = LocaleResources.GetStringByName("garage_shop_accordeon_scout_string");
- emptyIcon = GarageCarLineWindowV4.scoutSign24x24;
- break;
- case ServerDictionaries.ECarTypeIdEntity.STORMTANK:
- emptyIcon = GarageCarLineWindowV4.heavySign24x24;
- buttonName = LocaleResources.GetStringByName("garage_shop_accordeon_heavy_string");
- break;
- case ServerDictionaries.ECarTypeIdEntity.ENGINEER:
- emptyIcon = GarageCarLineWindowV4.engineerSign24x24;
- buttonName = LocaleResources.GetStringByName("garage_shop_accordeon_engineer_string");
- break;
- case ServerDictionaries.ECarTypeIdEntity.ARTILLERY:
- emptyIcon = GarageCarLineWindowV4.artillerySign24x24;
- buttonName = LocaleResources.GetStringByName("garage_shop_accordeon_artillery_string");
- break;
- }
- Rect a = new Rect(0f, -5f, 0f, 0f);
- if (TGUI.Button(this, Utils.SumRect(a, Utils.SumRect(_itemRect, this.accordeonButton.controlRect)), string.Empty, this.garageShopAccordeonButton))
- {
- carTypeChanged = this.SetCarLineDrawersByType(carType);
- }
- bool flag = _itemRect.x < this.formRect.width / 2f;
- bool flag2 = this.currentSelectedCarType == carType;
- TControl tcontrol = (!flag) ? this.accordeonRightLabel : this.accordeonLeftLabel;
- GUIStyle labelStyle;
- if (flag2)
- {
- labelStyle = ((!flag) ? this.garageCarLineAccordeonRightLabelStyle : this.garageCarLineAccordeonLeftLabelStyle);
- }
- else
- {
- labelStyle = ((!flag) ? this.garageCarLineAccordeonRightDisabledLabelStyle : this.garageCarLineAccordeonLeftDisabledLabelStyle);
- }
- Rect labelRect = Utils.SumRect(_itemRect, tcontrol.controlRect);
- TGUI.RotateAroundPivot(tcontrol.rotatePivot, tcontrol.rotateAngle, labelRect, delegate
- {
- GUI.Label(labelRect, buttonName, labelStyle);
- });
- GUI.DrawTexture(Utils.SumRect(_itemRect, this.accordeonSign.controlRect), emptyIcon.icon);
- _itemRect.x += this.accordeonButton.controlRect.width;
- }
- private bool SetCarLineDrawersByType(ServerDictionaries.ECarTypeIdEntity carType)
- {
- if (!GarageCarLineWindowV4.carScrollMoving && this.currentSelectedCarType != carType)
- {
- this.currentSelectedCarType = carType;
- return true;
- }
- return false;
- }
- private void DrawCarsOfType(ServerDictionaries.ECarTypeIdEntity carType, int num, ref Rect refRect, bool carTypeChanged)
- {
- if (this.currentSelectedCarType == carType)
- {
- GarageCarLineWindowV4.DrawCarsOfType.c__AnonStorey105 DrawCarsOfType.c__AnonStorey = new GarageCarLineWindowV4.DrawCarsOfType.c__AnonStorey105();
- DrawCarsOfType.c__AnonStorey.f__this = this;
- this.leftScrollButton.left = refRect.x;
- refRect.x += this.leftScrollButton.width;
- this.currentGarageCarLines = this.GetCarLineDrawersByType(carType);
- if (this.currentGarageCarLines == null)
- {
- return;
- }
- DrawCarsOfType.c__AnonStorey.viewRect = this.carLineControl.GetSizeRect();
- float x = refRect.x;
- GarageCarLineWindowV4.DrawCarsOfType.c__AnonStorey105 DrawCarsOfType.c__AnonStorey2 = DrawCarsOfType.c__AnonStorey;
- DrawCarsOfType.c__AnonStorey2.viewRect.x = DrawCarsOfType.c__AnonStorey2.viewRect.x + (0f + this.accordeonButton.controlRect.width * (float)num + this.leftScrollButton.width);
- GarageCarLineWindowV4.DrawCarsOfType.c__AnonStorey105 DrawCarsOfType.c__AnonStorey3 = DrawCarsOfType.c__AnonStorey;
- DrawCarsOfType.c__AnonStorey3.viewRect.width = DrawCarsOfType.c__AnonStorey3.viewRect.width - (4f * this.accordeonButton.controlRect.width + this.leftScrollButton.width + this.rightScrollButton.width);
- Rect viewRect = DrawCarsOfType.c__AnonStorey.viewRect;
- viewRect.width = (this.buttonSize.x + this.shiftBetweenCarButtons) * (float)this.currentGarageCarLines.Count;
- this.carViewBoxSize = new Vector2(viewRect.width, viewRect.height);
- DrawCarsOfType.c__AnonStorey.rect = refRect;
- DrawCarsOfType.c__AnonStorey.scrollPos = this.GetCurrentScrollPos();
- Action onDraw = delegate()
- {
- bool enabled = GUI.enabled;
- GUI.enabled = SpawnController.IsPreviousCarCreated;
- for (int i = 0; i < DrawCarsOfType.c__AnonStorey.f__this.currentGarageCarLines.Count; i++)
- {
- IGarageCarLineDrawer garageCarLineDrawer = DrawCarsOfType.c__AnonStorey.f__this.currentGarageCarLines[i];
- if (garageCarLineDrawer != null)
- {
- Rect a = Utils.SumRect(DrawCarsOfType.c__AnonStorey.f__this.formRect, DrawCarsOfType.c__AnonStorey.f__this.carLineControl.controlRect);
- Rect rect = Utils.SumRect(DrawCarsOfType.c__AnonStorey.f__this.formRect, DrawCarsOfType.c__AnonStorey.viewRect);
- Rect rect2 = Utils.SumRect(a, DrawCarsOfType.c__AnonStorey.rect);
- Rect rect3 = Utils.SumRect(rect2, DrawCarsOfType.c__AnonStorey.f__this.carLineWinX2Rect.controlRect);
- Rect screenRect = Utils.GetScreenRect(DrawCarsOfType.c__AnonStorey.scrollPos, rect3);
- Rect screenRect2 = Utils.GetScreenRect(DrawCarsOfType.c__AnonStorey.scrollPos, rect2);
- Rect rect4 = Utils.SumRect(rect2, DrawCarsOfType.c__AnonStorey.f__this.carLineReturnButtonRect.controlRect);
- Rect screenRect3 = Utils.GetScreenRect(DrawCarsOfType.c__AnonStorey.scrollPos, rect4);
- bool carButtonOver = false;
- if (a.Contains(GUIMain.mousePositionV2) && screenRect.Contains(GUIMain.mousePositionV2) && TForm.CanShowTooltip(DrawCarsOfType.c__AnonStorey.f__this) && garageCarLineDrawer is GarageCarLineDrawer)
- {
- GarageCarLineDrawer garageCarLineDrawer2 = garageCarLineDrawer as GarageCarLineDrawer;
- if (garageCarLineDrawer2.carData != null && garageCarLineDrawer2.carData.isFirstWinBonusActive)
- {
- GarageCarLineBonusX2TooltipWindow.ShowWindow(GUIMain.mousePositionV2 + 5f * Vector2.up);
- }
- }
- if (rect.Contains(GUIMain.mousePositionV2) && screenRect2.Contains(GUIMain.mousePositionV2))
- {
- carButtonOver = true;
- long entityId = garageCarLineDrawer.carDataInfo.carTypeEntityInstance.entityId;
- List<long> list = null;
- if (garageCarLineDrawer is GarageCarLineDrawer)
- {
- CarData carDataByModelId = GamerController.gamer.UserCars.GetCarDataByModelId(entityId);
- if (carDataByModelId != null)
- {
- list = (from x in carDataByModelId.serverCarData.serverCarItems
- select x.serverInstanceId).ToList<long>();
- }
- }
- if (garageCarLineDrawer is GarageDummyCarLineDrawer)
- {
- list = (from x in (garageCarLineDrawer as GarageDummyCarLineDrawer).showedModuleList
- select x.goTypeId).ToList<long>();
- list.AddRange((from x in (garageCarLineDrawer as GarageDummyCarLineDrawer).showedBarrelsList
- select x.goTypeId).ToList<long>());
- }
- if (list != null)
- {
- GarageCarMiniProfileWindowV3.ShowWindow(garageCarLineDrawer, DrawCarsOfType.c__AnonStorey.f__this, GamerController.gamer.UserCars, entityId, list, GUIMain.mousePositionV2);
- }
- }
- if (!screenRect2.Contains(GUIMain.mousePositionV2))
- {
- GarageCarMiniProfileWindowV3.HideWindow(garageCarLineDrawer, DrawCarsOfType.c__AnonStorey.f__this);
- }
- if (!rect.Contains(GUIMain.mousePositionV2))
- {
- GarageCarMiniProfileWindowV3.HideWindow(null, DrawCarsOfType.c__AnonStorey.f__this);
- }
- bool carReturnButtonOver = screenRect3.Contains(GUIMain.mousePositionV2);
- bool flag = garageCarLineDrawer.Draw(DrawCarsOfType.c__AnonStorey.rect, DrawCarsOfType.c__AnonStorey.f__this, DrawCarsOfType.c__AnonStorey.f__this.carLineExp, DrawCarsOfType.c__AnonStorey.f__this.carLineName, DrawCarsOfType.c__AnonStorey.f__this.carEliteIcon, DrawCarsOfType.c__AnonStorey.f__this.carLineInfo, DrawCarsOfType.c__AnonStorey.f__this.carRentTimer, DrawCarsOfType.c__AnonStorey.f__this.carLineReturnButtonRect, DrawCarsOfType.c__AnonStorey.f__this.carLineWinX2Rect, DrawCarsOfType.c__AnonStorey.f__this.carLineBonusExpRect, DrawCarsOfType.c__AnonStorey.f__this.carLineBuyButtonRect.controlRect, carButtonOver, carReturnButtonOver, DrawCarsOfType.c__AnonStorey.f__this.buyBackgroundRect.controlRect, DrawCarsOfType.c__AnonStorey.f__this.buyLabelRect.controlRect, DrawCarsOfType.c__AnonStorey.f__this.buyPriceRect.controlRect, DrawCarsOfType.c__AnonStorey.f__this.silverIconRect.controlRect, DrawCarsOfType.c__AnonStorey.f__this.lockedLabelRect.controlRect, DrawCarsOfType.c__AnonStorey.f__this.lockedPriceRect.controlRect, DrawCarsOfType.c__AnonStorey.f__this.lockedIconRect.controlRect);
- if (flag)
- {
- DrawCarsOfType.c__AnonStorey.f__this.SetCurrent(garageCarLineDrawer);
- }
- garageCarLineDrawer.scrollPos = DrawCarsOfType.c__AnonStorey.rect.x - DrawCarsOfType.c__AnonStorey.f__this.shiftBetweenCarButtons / 2f;
- DrawCarsOfType.c__AnonStorey.rect.x = DrawCarsOfType.c__AnonStorey.rect.x + (DrawCarsOfType.c__AnonStorey.f__this.buttonSize.x + DrawCarsOfType.c__AnonStorey.f__this.shiftBetweenCarButtons);
- Event current = Event.current;
- if (current.type == EventType.ScrollWheel && !GarageEquipmentSetupWindowV3.IsMouseOver && !GarageConsumableSetupWindowV3.IsMouseOver && !GarageCarLineWindowV4.carScrollMoving && GarageCarLineWindowV4.IsMouseOverCarBarControl)
- {
- if (current.delta.y < 0f)
- {
- DrawCarsOfType.c__AnonStorey.f__this.ScrollMovePrevoiusCar();
- }
- else
- {
- DrawCarsOfType.c__AnonStorey.f__this.ScrollMoveNextCar();
- }
- }
- }
- }
- GUI.enabled = enabled;
- };
- Vector2 vector = TGUI.ScrollView(this, DrawCarsOfType.c__AnonStorey.viewRect, DrawCarsOfType.c__AnonStorey.scrollPos, viewRect, this.garageChatsBoxScrollStyle, this.garageChatsBoxScrollStyle, onDraw);
- this.rightScrollButton.left = x + DrawCarsOfType.c__AnonStorey.viewRect.width;
- this.SetScrollPos(this.currentSelectedCarType, (!GarageCarLineWindowV4.IsMouseOverCarBarControl) ? DrawCarsOfType.c__AnonStorey.scrollPos : vector);
- refRect.x = x + DrawCarsOfType.c__AnonStorey.viewRect.width + this.rightScrollButton.width;
- if (carTypeChanged)
- {
- this.SetCarScrollButtons();
- }
- }
- }
- private void SetCurrent(IGarageCarLineDrawer carHolder)
- {
- foreach (List<IGarageCarLineDrawer> list in this.carTypeLineDictionary.Values)
- {
- list.ForEach(delegate(IGarageCarLineDrawer x)
- {
- x.isCurrent = false;
- });
- }
- carHolder.isCurrent = true;
- CustomLogger.LogInfo("GarageCarLineWindowV4.SetCurrent: id=" + carHolder.carDataInfo.carTypeEntityInstance.entityId, string.Empty);
- }
- private void SetCurrent()
- {
- long currentId = GamerController.gamer.UserCars.CurrentCar.carTypeEntityInstance.entityId;
- CustomLogger.LogInfo("GarageCarLineWindowV4.SetCurrent: current=" + currentId, string.Empty);
- foreach (List<IGarageCarLineDrawer> list in this.carTypeLineDictionary.Values)
- {
- list.ForEach(delegate(IGarageCarLineDrawer x)
- {
- x.isCurrent = (x.carDataInfo.carTypeEntityInstance.entityId == currentId);
- });
- }
- }
- private IGarageCarLineDrawer GetCurrent()
- {
- long currentId = GamerController.gamer.UserCars.CurrentCar.carTypeEntityInstance.entityId;
- foreach (List<IGarageCarLineDrawer> list in this.carTypeLineDictionary.Values)
- {
- IGarageCarLineDrawer garageCarLineDrawer = list.Find((IGarageCarLineDrawer x) => x.carDataInfo.carTypeEntityInstance.entityId == currentId);
- if (garageCarLineDrawer != null)
- {
- return garageCarLineDrawer;
- }
- }
- return null;
- }
- public void OnPressLeftScrollButton(object control)
- {
- this.ScrollMovePrevoiusCar();
- }
- private void OnScrollMoveEnd()
- {
- GarageCarLineWindowV4.carScrollMoving = false;
- this.SetScrollPos(this.currentSelectedCarType, this.carScrollEndPosition);
- this.SetCarScrollButtons();
- }
- private void ScrollMovePrevoiusCar()
- {
- if (this.leftScrollButton.style == "garageCarLineLeftScrollNotActiveButtonV3")
- {
- return;
- }
- if (GarageCarLineWindowV4.carScrollMoving)
- {
- return;
- }
- GarageCarLineWindowV4.carScrollMoving = true;
- Vector2 currentScrollPos = this.GetCurrentScrollPos();
- float num = (this.buttonSize.x + this.shiftBetweenCarButtons) * 4f;
- this.carScrollEndPosition = currentScrollPos.x - num;
- TimeUpdateController.AddLinearTimer(currentScrollPos.x, this.carScrollEndPosition, 0.25f, ref GarageCarLineWindowV4.carScrollValue, new Action(this.OnScrollMoveEnd));
- }
- public void OnPressRightScrollButton(object control)
- {
- this.ScrollMoveNextCar();
- }
- private void ScrollMoveNextCar()
- {
- if (this.rightScrollButton.style == "garageCarLineRightScrollNotActiveButtonV3")
- {
- return;
- }
- if (GarageCarLineWindowV4.carScrollMoving)
- {
- return;
- }
- GarageCarLineWindowV4.carScrollMoving = true;
- Vector2 currentScrollPos = this.GetCurrentScrollPos();
- float num = (this.buttonSize.x + this.shiftBetweenCarButtons) * 4f;
- this.carScrollEndPosition = currentScrollPos.x + num;
- TimeUpdateController.AddLinearTimer(currentScrollPos.x, this.carScrollEndPosition, 0.2f, ref GarageCarLineWindowV4.carScrollValue, new Action(this.OnScrollMoveEnd));
- }
- private void SetCarScrollButtons()
- {
- if (this.currentGarageCarLines == null || this.currentGarageCarLines.Count == 0)
- {
- this.currentGarageCarLines = this.GetCarLineDrawersByType(this.currentSelectedCarType);
- }
- float num = (this.buttonSize.x + this.shiftBetweenCarButtons) * (float)this.currentGarageCarLines.Count;
- this.leftScrollButton.style = "garageCarLineLeftScrollNotActiveButtonV3";
- this.rightScrollButton.style = "garageCarLineRightScrollNotActiveButtonV3";
- Vector2 currentScrollPos = this.GetCurrentScrollPos();
- CustomLogger.LogInfo(string.Concat(new object[]
- {
- "SetCarScrollButtons scrollPos.x=",
- currentScrollPos.x,
- " carViewBoxSize.x=",
- this.carViewBoxSize.x
- }), string.Empty);
- CustomLogger.LogInfo(string.Concat(new object[]
- {
- "SetCarScrollButtons count=",
- this.currentGarageCarLines.Count,
- " countOfshowdButtons=",
- this.countOfshowdButtons
- }), string.Empty);
- if (currentScrollPos.x > 0f)
- {
- this.leftScrollButton.style = "garageCarLineLeftScrollButtonV3";
- }
- if (currentScrollPos.x < num - this.viewRectWidth && this.currentGarageCarLines.Count > this.countOfshowdButtons)
- {
- this.rightScrollButton.style = "garageCarLineRightScrollButtonV3";
- }
- }
- public void OnPressMenuButton(object control)
- {
- ExitGarageMenuWindowV3.ShowWindow();
- }
- public void OnPressSquadButton(object control)
- {
- }
- public void UpdateChatsBoxStyles()
- {
- if (this.garageChatsBoxLeftRewindActiveStyle == null)
- {
- this.garageChatsBoxLeftRewindActiveStyle = GUI.skin.FindStyle("garageChatsBoxLeftRewindActive");
- }
- if (this.garageChatsBoxLeftRewindNotactiveStyle == null)
- {
- this.garageChatsBoxLeftRewindNotactiveStyle = GUI.skin.FindStyle("garageChatsBoxLeftRewindNotactive");
- }
- if (this.garageChatsBoxRightRewindActiveStyle == null)
- {
- this.garageChatsBoxRightRewindActiveStyle = GUI.skin.FindStyle("garageChatsBoxRightRewindActive");
- }
- if (this.garageChatsBoxRightRewindNotactiveStyle == null)
- {
- this.garageChatsBoxRightRewindNotactiveStyle = GUI.skin.FindStyle("garageChatsBoxRightRewindNotactive");
- }
- if (this.garageChatsBoxMinimizedChatButtonStyle == null)
- {
- this.garageChatsBoxMinimizedChatButtonStyle = GUI.skin.FindStyle("garageChatsBoxMinimizedChatButton");
- }
- if (this.garageChatsBoxMaximizedChatButtonStyle == null)
- {
- this.garageChatsBoxMaximizedChatButtonStyle = GUI.skin.FindStyle("garageChatsBoxMaximizedChatButton");
- }
- if (this.garageChatsBoxClosedIncomeChatButtonStyle == null)
- {
- this.garageChatsBoxClosedIncomeChatButtonStyle = GUI.skin.FindStyle("garageChatsBoxClosedIncomeChatButton");
- }
- if (this.garageChatsBoxScrollStyle == null)
- {
- this.garageChatsBoxScrollStyle = GUI.skin.FindStyle("garageChatsBoxVerticalScrollbar");
- }
- if (this.garageShopAccordeonButton == null)
- {
- this.garageShopAccordeonButton = GUI.skin.FindStyle("garageHorizontalAccordeonButton");
- }
- if (this.garageShopRepayDescStyleV3 == null)
- {
- this.garageShopRepayDescStyleV3 = GUI.skin.FindStyle("garageShopRepayDescStyleV3");
- }
- if (this.garageCarLinePriceStyle == null)
- {
- this.garageCarLinePriceStyle = GUI.skin.FindStyle("garageCarLinePriceStyle");
- }
- if (this.garageCarLineAccordeonLeftLabelStyle == null)
- {
- this.garageCarLineAccordeonLeftLabelStyle = GUI.skin.FindStyle("garageCarLineAccordeonLeftLabelstyle");
- }
- if (this.garageCarLineAccordeonLeftDisabledLabelStyle == null)
- {
- this.garageCarLineAccordeonLeftDisabledLabelStyle = GUI.skin.FindStyle("garageCarLineAccordeonLeftDisabledLabelStyle");
- }
- if (this.garageCarLineAccordeonRightDisabledLabelStyle == null)
- {
- this.garageCarLineAccordeonRightDisabledLabelStyle = GUI.skin.FindStyle("garageCarLineAccordeonRightDisabledLabelStyle");
- }
- if (this.garageCarLineAccordeonRightLabelStyle == null)
- {
- this.garageCarLineAccordeonRightLabelStyle = GUI.skin.FindStyle("garageCarLineAccordeonRightLabelstyle");
- }
- }
- public static void AddPanelButton(GarageDownPanelButton button, GarageDownPanelButton.ButtonState state = GarageDownPanelButton.ButtonState.maximized)
- {
- if (GarageCarLineWindowV4.instance != null)
- {
- button.SetStatus(state);
- GarageCarLineWindowV4.instance.panelButtons.Add(button);
- }
- }
- public static void RemovePanelButton(GaragePrivateChatWindow window)
- {
- if (GarageCarLineWindowV4.instance != null)
- {
- int num = -1;
- for (int i = 0; i < GarageCarLineWindowV4.instance.panelButtons.Count; i++)
- {
- if (GarageCarLineWindowV4.instance.panelButtons[i] is ChatPanelButton && (GarageCarLineWindowV4.instance.panelButtons[i] as ChatPanelButton).chatWindow.Chater.UserId == window.Chater.UserId)
- {
- num = i;
- }
- }
- if (num > -1)
- {
- GarageCarLineWindowV4.instance.panelButtons.RemoveAt(num);
- }
- }
- }
- public static void RemovePanelButton(GarageDownPanelButton buttonToRemove)
- {
- if (GarageCarLineWindowV4.instance != null)
- {
- GarageCarLineWindowV4.instance.panelButtons.Remove(buttonToRemove);
- }
- }
- public static InvitePanelButton ContainInviteButton(long userId)
- {
- foreach (GarageDownPanelButton garageDownPanelButton in GarageCarLineWindowV4.instance.panelButtons)
- {
- InvitePanelButton invitePanelButton = garageDownPanelButton as InvitePanelButton;
- if (invitePanelButton != null && invitePanelButton.inviter.UserId == userId)
- {
- return invitePanelButton;
- }
- }
- return null;
- }
- public void OnPaintChatsBoxControl(object control)
- {
- if (this.panelButtons.Count == 0)
- {
- return;
- }
- this.UpdateChatsBoxStyles();
- Rect rect = new Rect(0f, this.chatsBoxControl.height / 2f - this.chatsBoxRewindButtonRect.height / 2f, this.chatsBoxRewindButtonRect.width, this.chatsBoxRewindButtonRect.height);
- Rect rect2 = new Rect(this.chatsBoxControl.width - this.chatsBoxRewindButtonRect.width, this.chatsBoxControl.height / 2f - this.chatsBoxRewindButtonRect.height / 2f, this.chatsBoxRewindButtonRect.width, this.chatsBoxRewindButtonRect.height);
- Rect rect3 = new Rect(this.chatsBoxWindowsAreaRect.controlRect.x, 0f, this.chatsBoxWindowsAreaRect.controlRect.width, this.chatsBoxWindowsAreaRect.controlRect.height);
- Rect viewRect = rect3;
- viewRect.width = this.chatsBoxWindowButtonRect.controlRect.width * (float)this.panelButtons.Count;
- viewRect.height += 20f;
- GUIStyle style = (this.chatsBoxScrollPos.x != 0f) ? this.garageChatsBoxLeftRewindActiveStyle : this.garageChatsBoxLeftRewindNotactiveStyle;
- if (TGUI.RepeatButton(this, rect, string.Empty, style))
- {
- this.chatsBoxScrollPos.x = this.chatsBoxScrollPos.x - 10f;
- }
- GUIStyle style2 = (this.chatsBoxScrollPos.x != viewRect.width) ? this.garageChatsBoxRightRewindActiveStyle : this.garageChatsBoxRightRewindNotactiveStyle;
- if (TGUI.RepeatButton(this, rect2, string.Empty, style2))
- {
- this.chatsBoxScrollPos.x = this.chatsBoxScrollPos.x + 10f;
- }
- Rect controlRect = this.chatsBoxWindowButtonRect.controlRect;
- this.chatsBoxScrollPos = GUI.BeginScrollView(rect3, this.chatsBoxScrollPos, viewRect, this.garageChatsBoxScrollStyle, this.garageChatsBoxScrollStyle);
- for (int i = 0; i < this.panelButtons.Count; i++)
- {
- this.panelButtons[i].Draw(this, controlRect);
- controlRect.x += controlRect.width;
- }
- GUI.EndScrollView();
- }
- public static void HideLeftPanel()
- {
- GarageCarLineWindowV4.instance.HideLeftPanelWindows();
- }
- public static void HideRightPanel()
- {
- GarageCarLineWindowV4.instance.HideRightPanelWindows();
- }
- private void HideLeftPanelWindows()
- {
- GarageQuestsWindowV3.HideWindow();
- GarageAchievementsWindowV3.HideWindow();
- GarageChatWindowV3.HideWindow();
- GarageModeratorChatWindowV3.HideWindow();
- }
- private void HideRightPanelWindows()
- {
- GarageFriendsWindowV3.HideWindow();
- GarageNewsWindowV3.HideWindow();
- GarageActionsWindowV3.HideWindow();
- }
- public void OnPressTabChatButton(object control)
- {
- GarageCarLineWindowV4.OpenLeftPanel(GarageCarLineWindowV4.ELeftTabMode.CHAT, false);
- }
- public void OnPressTabModeratorChatButton(object control)
- {
- GarageCarLineWindowV4.OpenLeftPanel(GarageCarLineWindowV4.ELeftTabMode.MODERATORCHAT, false);
- }
- public void OnPressTabQuestsButton(object control)
- {
- GarageCarLineWindowV4.OpenLeftPanel(GarageCarLineWindowV4.ELeftTabMode.QUESTS, false);
- }
- public void OnPressTabAchievementsButton(object control)
- {
- GarageCarLineWindowV4.OpenLeftPanel(GarageCarLineWindowV4.ELeftTabMode.ACHIEVEMENTS, false);
- }
- public void OnPressTabActionsButton(object control)
- {
- GarageCarLineWindowV4.OpenRightPanel(GarageCarLineWindowV4.ERightTabMode.ACTIONS, false);
- }
- public void OnPressTabNewsButton(object control)
- {
- GarageCarLineWindowV4.OpenRightPanel(GarageCarLineWindowV4.ERightTabMode.NEWS, false);
- }
- public void OnPressTabFriendsButton(object control)
- {
- GarageCarLineWindowV4.OpenRightPanel(GarageCarLineWindowV4.ERightTabMode.FRIENDS, false);
- }
- public static GarageCarLineWindowV4.ELeftTabMode CurrentLeftMode
- {
- get
- {
- return GarageCarLineWindowV4.instance.currentLeftMode;
- }
- }
- public static GarageCarLineWindowV4.ERightTabMode CurrentRightMode
- {
- get
- {
- return GarageCarLineWindowV4.instance.currentRightMode;
- }
- }
- public static void OpenLeftPanel(GarageCarLineWindowV4.ELeftTabMode mode, bool immediately = false)
- {
- GarageCarLineWindowV4.instance.OpenLeftPanelInternal(mode, immediately, false);
- }
- private void OpenLeftPanelInternal(GarageCarLineWindowV4.ELeftTabMode mode, bool immediately = false, bool hideButKeep = false)
- {
- this.HideLeftPanelWindows();
- this.SetLeftTabButtonActive(null);
- if (!hideButKeep)
- {
- if (this.currentLeftMode == mode && !immediately)
- {
- this.currentLeftMode = GarageCarLineWindowV4.ELeftTabMode.NONE;
- }
- else
- {
- switch (mode)
- {
- case GarageCarLineWindowV4.ELeftTabMode.CHAT:
- GarageChatWindowV3.ShowWindow();
- this.SetLeftTabButtonActive(this.tabChatButton);
- break;
- case GarageCarLineWindowV4.ELeftTabMode.QUESTS:
- GarageQuestsWindowV3.ShowWindow();
- this.SetLeftTabButtonActive(this.tabQuestsButton);
- break;
- case GarageCarLineWindowV4.ELeftTabMode.ACHIEVEMENTS:
- GarageAchievementsWindowV3.ShowWindow();
- this.SetLeftTabButtonActive(this.tabAchievementsButton);
- break;
- case GarageCarLineWindowV4.ELeftTabMode.MODERATORCHAT:
- GarageModeratorChatWindowV3.ShowWindow();
- this.SetLeftTabButtonActive(this.tabModeratorChatButton);
- break;
- }
- this.currentLeftMode = mode;
- }
- }
- }
- }
*код не весь т.к ограничение*
скрипт для скачивания (навсякий): https://disk.yandex.ru/d/3Iq38GqOjUO4SA