Exemple #1
0
        private void RecountRows(TimeableList <TicketPriceEntryXml> config, int?stopsCount, ref TransportLine tl)
        {
            TLMTicketPriceEditorLine[] currentLines = m_entryListContainer.GetComponentsInChildren <TLMTicketPriceEditorLine>();
            m_timeRows = new List <TLMTicketPriceEditorLine>();
            var  tsd            = TransportSystemDefinition.GetDefinitionForLine(ref tl);
            uint maxTicketPrice = TLMLineUtils.GetTicketPriceForLine(tsd, 0).First.Value * 5;
            int  count          = 0;

            for (int i = 0; i < stopsCount; i++, count++)
            {
                if (i < currentLines.Length)
                {
                    currentLines[i].SetLegendInfo(GetColorForNumber(i), maxTicketPrice);
                    m_timeRows.Add(currentLines[i]);
                    currentLines[i].Entry = config[i];
                }
                else
                {
                    TLMTicketPriceEditorLine line = KlyteMonoUtils.CreateElement <TLMTicketPriceEditorLine>(m_entryListContainer.transform);
                    line.Entry = config[i];
                    line.SetLegendInfo(GetColorForNumber(i), maxTicketPrice);
                    line.OnTimeChanged   += ValidateTime;
                    line.OnDie           += RemoveTime;
                    line.OnBudgetChanged += SetBudget;
                    m_timeRows.Add(line);
                }
            }
            for (int i = count; i < currentLines.Length; i++)
            {
                GameObject.Destroy(currentLines[i].gameObject);
            }
        }
Exemple #2
0
        public void OnSettingsUI(UIHelperBase helperDefault)
        {
            m_onSettingsUiComponent = new UIHelperExtension((UIHelper)helperDefault).Self ?? m_onSettingsUiComponent;

            if (Locale.Get(KlyteLocaleManager.m_defaultTestKey) != "OK" || Locale.Get(KlyteLocaleManager.m_defaultModControllingKey) == CommonProperties.ModName)
            {
                if (Locale.Get(KlyteLocaleManager.m_defaultModControllingKey) != CommonProperties.ModName)
                {
                    KlyteMonoUtils.CreateElement <KlyteLocaleManager>(new GameObject(typeof(U).Name).transform);
                    if (Locale.Get(KlyteLocaleManager.m_defaultTestKey) != "OK")
                    {
                        LogUtils.DoErrorLog("CAN'T LOAD LOCALE!!!!!");
                    }
                    LocaleManager.eventLocaleChanged += KlyteLocaleManager.ReloadLanguage;
                }

                m_showLangDropDown = true;
            }
            foreach (string lang in KlyteLocaleManager.locales)
            {
                string content = KlyteResourceLoader.LoadResourceString($"UI.i18n.{lang}.properties");
                if (content != null)
                {
                    File.WriteAllText($"{KlyteLocaleManager.m_translateFilesPath}{lang}{Path.DirectorySeparatorChar}1_{Assembly.GetExecutingAssembly().GetName().Name}.txt", content);
                }
                content = KlyteResourceLoader.LoadResourceString($"commons.UI.i18n.{lang}.properties");
                if (content != null)
                {
                    File.WriteAllText($"{KlyteLocaleManager.m_translateFilesPath}{lang}{Path.DirectorySeparatorChar}0_common_{K45DialogControl.VERSION}.txt", content);
                }
            }
            KlyteLocaleManager.ReloadLanguage(true);
            DoWithSettingsUI(new UIHelperExtension(m_onSettingsUiComponent));
        }
        private void RecountRows(TimeableList <BudgetEntryXml> config, int?stopsCount)
        {
            UVMBudgetEditorLine[] currentLines = m_entryListContainer.GetComponentsInChildren <UVMBudgetEditorLine>();
            m_timeRows = new List <UVMBudgetEditorLine>();
            int count = 0;

            for (int i = 0; i < stopsCount; i++, count++)
            {
                if (i < currentLines.Length)
                {
                    currentLines[i].SetLegendInfo(GetColorForNumber(i));
                    m_timeRows.Add(currentLines[i]);
                    currentLines[i].Entry = config[i];
                }
                else
                {
                    UVMBudgetEditorLine line = KlyteMonoUtils.CreateElement <UVMBudgetEditorLine>(m_entryListContainer.transform);
                    line.Entry = config[i];
                    line.SetLegendInfo(GetColorForNumber(i));
                    line.OnTimeChanged   += ValidateTime;
                    line.OnDie           += RemoveTime;
                    line.OnBudgetChanged += SetBudget;
                    m_timeRows.Add(line);
                }
            }
            for (int i = count; i < currentLines.Length; i++)
            {
                GameObject.Destroy(currentLines[i].gameObject);
            }
        }
        public void Awake()
        {
            MainContainer       = GetComponent <UIComponent>();
            m_uiHelperNeighbors = new UIHelperExtension(MainContainer);

            ((UIScrollablePanel)m_uiHelperNeighbors.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIScrollablePanel)m_uiHelperNeighbors.Self).wrapLayout          = true;
            ((UIScrollablePanel)m_uiHelperNeighbors.Self).width = 370;

            m_neighborFileSelect       = m_uiHelperNeighbors.AddDropdownLocalized("K45_ADR_REGION_CITIES_FILE", new string[0], -1, OnChangeSelectedNeighborFile);
            m_neighborFileSelect.width = 370;
            m_uiHelperNeighbors.AddSpace(1);
            KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperNeighbors.AddButton(Locale.Get("K45_ADR_ROAD_NAME_FILES_RELOAD"), ReloadOptionsFilesNeighbor), 380);
            m_uiHelperNeighbors.AddSpace(10);

            UILabel titleLabel = m_uiHelperNeighbors.AddLabel("");

            titleLabel.autoSize      = true;
            titleLabel.textAlignment = UIHorizontalAlignment.Center;
            titleLabel.minimumSize   = new Vector2(370, 0);
            KlyteMonoUtils.LimitWidth(titleLabel, 370);
            titleLabel.localeID = "K45_ADR_AZIMUTH_EDITOR_TITLE";

            m_uiHelperNeighbors.AddSpace(5);
            KlyteMonoUtils.CreateElement(out m_borderChart, m_uiHelperNeighbors.Self.transform, "NeighborArea");
            m_uiHelperNeighbors.AddSpace(30);
            KlyteMonoUtils.CreateElement <AdrAzimuthTitleLineNeighbor>(m_uiHelperNeighbors.Self.transform);
            m_uiHelperNeighbors.AddSpace(5);

            ReloadOptionsFilesNeighbor();
        }
        private void RebuildList()
        {
            AdrAzimuthEditorLineNeighbor[] currentLines = m_uiHelperNeighbors.Self.GetComponentsInChildren <AdrAzimuthEditorLineNeighbor>();
            int stopsCount = AdrNeighborhoodExtension.GetStopsCount();

            if (stopsCount == 0)
            {
                stopsCount = 1;
            }

            m_borderCities = new List <AdrAzimuthEditorLineNeighbor>();
            int count = 0;

            for (int i = 0; i < stopsCount; i++, count++)
            {
                if (i < currentLines.Length)
                {
                    currentLines[i].SetLegendInfo(GetColorForNumber(i), i + 1);
                    m_borderCities.Add(currentLines[i]);
                }
                else
                {
                    AdrAzimuthEditorLineNeighbor line = KlyteMonoUtils.CreateElement <AdrAzimuthEditorLineNeighbor>(m_uiHelperNeighbors.Self.transform);
                    line.SetLegendInfo(GetColorForNumber(i), i + 1);
                    line.OnValueChange += ValidateAngleStr;
                    m_borderCities.Add(line);
                }
            }
            for (int i = count; i < currentLines.Length; i++)
            {
                GameObject.Destroy(currentLines[i].gameObject);
            }
            ReordenateFields();
        }
Exemple #6
0
        public void Awake()
        {
            if (instance != null)
            {
                Destroy(this);
                return;
            }
            instance = this;
            var gameObject = GameObject.FindGameObjectWithTag("MainCamera");

            if (gameObject != null)
            {
                m_CameraController = gameObject.GetComponent <CameraController>();
            }
            createInfoView();
            CreateIgnoreDistrictOption();

            KlyteMonoUtils.CreateUIElement(out UIPanel confContainer, panelTransform, "SubConfigContainer", new Vector4(m_buildingInfoPanel.width, 0, 0, m_buildingInfoPanel.height));
            confContainer.autoLayout          = true;
            confContainer.autoLayoutDirection = LayoutDirection.Horizontal;
            confContainer.wrapLayout          = false;
            confContainer.height       = m_buildingInfoPanel.height;
            confContainer.clipChildren = false;

            foreach (KeyValuePair <ServiceSystemDefinition, IVMCSysDef> kv in ServiceSystemDefinition.sysDefinitions)
            {
                Type targetType = ReflectionUtils.GetImplementationForGenericType(typeof(VMCBuildingSSDConfigWindow <>), kv.Value.GetType());
                KlyteMonoUtils.CreateElement(targetType, confContainer.transform);
            }
        }
Exemple #7
0
        public void Awake()
        {
            RedirectorInstance = KlyteMonoUtils.CreateElement <Redirector>(transform);
            LogUtils.DoLog("Loading Building Manager Overrides");
            MethodInfo posRename = GetType().GetMethod("OnBuildingNameChanged", RedirectorUtils.allFlags);
            MethodInfo calcGroup = typeof(BuildingManager).GetMethod("CalculateGroupData");
            MethodInfo popGroup  = typeof(BuildingManager).GetMethod("PopulateGroupData");


            System.Reflection.MethodInfo postRenderMeshs = GetType().GetMethod("TranspileEndRenderingImpl", RedirectorUtils.allFlags);
            var        orMeth = typeof(BuildingManager).GetMethod("EndRenderingImpl", RedirectorUtils.allFlags & ~BindingFlags.Public);
            MethodInfo AfterCalculateGroupData = GetType().GetMethod("AfterCalculateGroupData", RedirectorUtils.allFlags);
            MethodInfo AfterPopulateGroupData  = GetType().GetMethod("AfterPopulateGroupData", RedirectorUtils.allFlags);


            MethodInfo zoneUpdated           = typeof(BuildingManager).GetMethod("AfterTerrainUpdate");
            MethodInfo zonesUpdatedTranspile = GetType().GetMethod("AfterTerrainUpdateTranspile", RedirectorUtils.allFlags);

            LogUtils.DoLog($"Patching=> {posRename}");
            //RedirectorInstance.AddRedirect(BuildingManager.instance.SetBuildingName(0, "").GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), null, posRename);
            LogUtils.DoLog($"Patching=> {AfterCalculateGroupData}");
            RedirectorInstance.AddRedirect(calcGroup, null, AfterCalculateGroupData);
            LogUtils.DoLog($"Patching=> {AfterPopulateGroupData}");
            RedirectorInstance.AddRedirect(popGroup, null, AfterPopulateGroupData);
            LogUtils.DoLog($"Patching=> {postRenderMeshs}");
            RedirectorInstance.AddRedirect(orMeth, null, null, postRenderMeshs);
            LogUtils.DoLog($"Patching=> {zonesUpdatedTranspile}");
            RedirectorInstance.AddRedirect(zoneUpdated, null, null, zonesUpdatedTranspile);
        }
Exemple #8
0
        public void Awake()
        {
            Instance      = this;
            MainContainer = GetComponent <UIComponent>();
            m_uiHelper    = new UIHelperExtension(MainContainer);

            ((UIPanel)m_uiHelper.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)m_uiHelper.Self).wrapLayout          = true;
            ((UIPanel)m_uiHelper.Self).autoLayout          = true;

            UILabel titleLabel = m_uiHelper.AddLabel("");

            titleLabel.autoSize      = true;
            titleLabel.textAlignment = UIHorizontalAlignment.Center;
            titleLabel.wordWrap      = false;
            titleLabel.minimumSize   = new Vector2(MainContainer.width - 10, 0);;
            titleLabel.localeID      = "K45_TLM_PER_HOUR_TICKET_PRICE_TITLE";

            m_uiHelper.AddSpace(5);
            KlyteMonoUtils.CreateElement(out m_clockChart, m_uiHelper.Self.transform, "DailyClock");
            m_uiHelper.AddSpace(20);
            KlyteMonoUtils.CreateElement(out m_titleContainer, m_uiHelper.Self.transform, "Title");
            PopulateTitlePanel(m_titleContainer);
            KlyteMonoUtils.CreateScrollPanel(m_uiHelper.Self, out m_entryListContainer, out _, m_uiHelper.Self.width - 20f, m_uiHelper.Self.height - 150, Vector3.zero);
        }
        public void Awake()
        {
            Instance            = this;
            MainContainer       = GetComponent <UIComponent>();
            m_uiHelperNeighbors = new UIHelperExtension(MainContainer);

            ((UIPanel)m_uiHelperNeighbors.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)m_uiHelperNeighbors.Self).wrapLayout          = true;
            ((UIPanel)m_uiHelperNeighbors.Self).autoLayout          = true;

            UILabel titleLabel = m_uiHelperNeighbors.AddLabel("");

            titleLabel.autoSize      = true;
            titleLabel.textAlignment = UIHorizontalAlignment.Center;
            titleLabel.wordWrap      = false;
            titleLabel.minimumSize   = new Vector2(MainContainer.width - 10, 0);
            titleLabel.localeID      = "K45_TLM_PER_HOUR_BUDGET_TITLE";

            m_uiHelperNeighbors.AddSpace(5);
            KlyteMonoUtils.CreateElement(out m_clockChart, m_uiHelperNeighbors.Self.transform, "DailyClock");
            m_showAbsoluteCheckbox = m_uiHelperNeighbors.AddCheckboxLocale("K45_TLM_SHOW_ABSOLUTE_VALUE", false, (x) =>
            {
                RebuildList(UVMPublicTransportWorldInfoPanel.GetLineID());
            });
            KlyteMonoUtils.LimitWidthAndBox(m_showAbsoluteCheckbox.label, m_uiHelperNeighbors.Self.width - 40f);
            KlyteMonoUtils.CreateElement(out m_titleContainer, m_uiHelperNeighbors.Self.transform, "Title");
            PopulateTitlePanel(m_titleContainer);
            KlyteMonoUtils.CreateScrollPanel(m_uiHelperNeighbors.Self, out m_entryListContainer, out _, m_uiHelperNeighbors.Self.width - 20f, m_uiHelperNeighbors.Self.height - 150, Vector3.zero);
        }
        public void Awake()
        {
            RedirectorInstance = KlyteMonoUtils.CreateElement <Redirector>(transform);
            LogUtils.DoLog("Loading Instance Manager Overrides");
            #region Release Line Hooks
            MethodInfo posRename = typeof(InstanceManagerOverrides).GetMethod("OnInstanceRenamed", RedirectorUtils.allFlags);

            RedirectorInstance.AddRedirect(typeof(InstanceManager).GetMethod("SetName", RedirectorUtils.allFlags), null, posRename);
            #endregion
        }
        public void Start()
        {
            RedirectorInstance = KlyteMonoUtils.CreateElement <Redirector>(transform);
            LogUtils.DoLog("Loading District Manager Overrides");
            #region Release Line Hooks
            MethodInfo posChange = typeof(VMCController).GetMethod("OnDistrictChanged", RedirectorUtils.allFlags);

            RedirectorInstance.AddRedirect(typeof(DistrictManager).GetMethod("SetDistrictName", RedirectorUtils.allFlags), null, posChange);
            RedirectorInstance.AddRedirect(typeof(DistrictManager).GetMethod("AreaModified", RedirectorUtils.allFlags), null, posChange);
            #endregion
        }
Exemple #12
0
 private void SetPreviewWindow()
 {
     KlyteMonoUtils.CreateUIElement(out m_previewPanel, m_mainPanel.transform);
     m_previewPanel.backgroundSprite = "GenericPanel";
     m_previewPanel.width            = m_parent.width - 400f;
     m_previewPanel.height           = 170;
     m_previewPanel.relativePosition = new Vector3(-m_previewPanel.width, m_mainPanel.height - 175);
     KlyteMonoUtils.CreateUIElement(out m_preview, m_previewPanel.transform);
     m_preview.size             = m_previewPanel.size;
     m_preview.relativePosition = Vector3.zero;
     KlyteMonoUtils.CreateElement(out m_previewRenderer, m_mainPanel.transform);
     m_previewRenderer.Size           = m_preview.size * 2f;
     m_preview.texture                = m_previewRenderer.Texture;
     m_previewRenderer.Zoom           = 3;
     m_previewRenderer.CameraRotation = 40;
 }
        public void Awake()
        {
            RedirectorInstance = KlyteMonoUtils.CreateElement <Redirector>(transform);
            LogUtils.DoLog("Loading Transport Manager Overrides");
            #region Release Line Hooks
            MethodInfo posUpdate     = typeof(TransportManagerOverrides).GetMethod("PushIntoStackLine", RedirectorUtils.allFlags);
            MethodInfo posAddStop    = typeof(TransportManagerOverrides).GetMethod("PushIntoStackBuilding", RedirectorUtils.allFlags);
            MethodInfo preRemoveStop = typeof(TransportManagerOverrides).GetMethod("BeforeRemoveStop", RedirectorUtils.allFlags);
            MethodInfo posRemoveLine = typeof(TransportManagerOverrides).GetMethod("AfterRemoveLine", RedirectorUtils.allFlags);

            RedirectorInstance.AddRedirect(typeof(TransportManager).GetMethod("UpdateLine", RedirectorUtils.allFlags), null, posUpdate);
            RedirectorInstance.AddRedirect(typeof(TransportLine).GetMethod("AddStop", RedirectorUtils.allFlags), null, posAddStop);
            RedirectorInstance.AddRedirect(typeof(TransportLine).GetMethod("RemoveStop", RedirectorUtils.allFlags, null, new Type[] { typeof(ushort), typeof(int), typeof(Vector3).MakeByRefType() }, null), preRemoveStop);
            RedirectorInstance.AddRedirect(typeof(TransportManager).GetMethod("ReleaseLine", RedirectorUtils.allFlags), null, posRemoveLine);
            #endregion
        }
Exemple #14
0
#pragma warning restore IDE0051 // Remover membros privados não utilizados

        #region Hooking

        public void Awake()
        {
            LogUtils.DoLog("Loading Net Manager Overrides");
            RedirectorInstance = KlyteMonoUtils.CreateElement <Redirector>(transform);
            #region Net Manager Hooks
            MethodInfo OnNodeChanged               = GetType().GetMethod("OnNodeChanged", RedirectorUtils.allFlags);
            MethodInfo OnSegmentCreated            = GetType().GetMethod("OnSegmentCreated", RedirectorUtils.allFlags);
            MethodInfo OnSegmentReleased           = GetType().GetMethod("OnSegmentReleased", RedirectorUtils.allFlags);
            MethodInfo OnSegmentNameChanged        = GetType().GetMethod("OnSegmentNameChanged", RedirectorUtils.allFlags);
            MethodInfo AfterTerrainUpdateTranspile = GetType().GetMethod("AfterTerrainUpdateTranspile", RedirectorUtils.allFlags);

            RedirectorInstance.AddRedirect(typeof(NetManager).GetMethod("CreateNode", RedirectorUtils.allFlags), null, OnNodeChanged);
            RedirectorInstance.AddRedirect(typeof(NetManager).GetMethod("ReleaseNode", RedirectorUtils.allFlags), null, OnNodeChanged);
            RedirectorInstance.AddRedirect(typeof(NetManager).GetMethod("CreateSegment", RedirectorUtils.allFlags, null, new[] { typeof(ushort).MakeByRefType(), typeof(Randomizer).MakeByRefType(), typeof(NetInfo), typeof(TreeInfo), typeof(ushort), typeof(ushort), typeof(Vector3), typeof(Vector3), typeof(uint), typeof(uint), typeof(bool) }, null), null, OnSegmentCreated);
            RedirectorInstance.AddRedirect(typeof(NetManager).GetMethod("ReleaseSegment", RedirectorUtils.allFlags), OnSegmentReleased);
            RedirectorInstance.AddRedirect(typeof(NetManager).GetMethod("SetSegmentNameImpl", RedirectorUtils.allFlags), null, OnSegmentNameChanged);
            RedirectorInstance.AddRedirect(typeof(NetManager).GetMethod("AfterTerrainUpdate", RedirectorUtils.allFlags), null, null, AfterTerrainUpdateTranspile);
            #endregion
        }
Exemple #15
0
        protected override void AwakeActions()
        {
            KlyteMonoUtils.CreateUIElement(out m_stripMain, MainPanel.transform, "WTSTabstrip", new Vector4(5, 40, MainPanel.width - 10, 40));
            m_stripMain.startSelectedIndex = -1;
            m_stripMain.selectedIndex      = -1;

            KlyteMonoUtils.CreateUIElement(out UITabContainer tabContainer, MainPanel.transform, "WTSTabContainer", new Vector4(0, 80, MainPanel.width, MainPanel.height - 80));
            m_stripMain.tabPages = tabContainer;

            //m_stripMain.CreateTabLocalized<WTSPropPlacingTab2>("InfoIconEscapeRoutes", "K45_WTS_HIGHWAY_SIGN_CONFIG_TAB", "WTSHighwaySign");
            //m_stripMain.CreateTabLocalized<WTSMileageMarkerTab3>("LocationMarkerNormal", "K45_WTS_MILEAGE_MARKERS_CONFIG_TAB", "WTSMileageMarkerTab");
            //m_stripMain.CreateTabLocalized<WTSBuildingEditorTab2>("IconAssetBuilding", "K45_WTS_BUILDING_CONFIG_TAB", "WTSBuildingEditorTab");
            m_stripMain.CreateTabLocalized <WTSPropLayoutEditor>("IconAssetProp", "K45_WTS_PROP_LIBRARY_EDITOR_TAB", "WTSBuildingEditorTab", false);
            m_stripMain.CreateTabLocalized <WTSRoadCornerEditor>("InfoIconTrafficRoutes", "K45_WTS_STREET_SIGN_CONFIG_TAB", "WTSStreetSign", false);
            m_stripMain.CreateTabLocalized <WTSBuildingLayoutEditor>("IconAssetBuilding", "K45_WTS_BUILDING_CONFIG_TAB", "WTSBuildingSettings", false);
            m_stripMain.CreateTabLocalized <WTSVehicleLayoutEditor>("IconAssetVehicle", "K45_WTS_VEHICLE_CONFIG_TAB", "WTSVehicleLayoutEditor", false);
            m_stripMain.CreateTabLocalized <WTSFontsSettings>(KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon), "K45_WTS_FONT_CONFIG_TAB", "WTSFontSettings", false);



            KlyteMonoUtils.CreateElement <WTSOnNetLiteUI>(UIView.GetAView().transform.Find("TSBar").gameObject.transform);
        }
Exemple #16
0
        private void Awake()
        {
            VMCTabPanel.eventOnDistrictSelectionChanged += onDistrictChanged;


            mainPanel            = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout = false;
            m_uiHelper           = new UIHelperExtension(mainPanel);

            KlyteMonoUtils.CreateUIElement(out UILabel lbl, mainPanel.transform, "DistrictColorLabel", new Vector4(5, 5, 250, 40));

            allowColorChange = SingletonLite <T> .instance.GetSSD().AllowColorChanging();

            if (allowColorChange)
            {
                KlyteMonoUtils.LimitWidth(lbl, 250);
                lbl.autoSize = true;
                lbl.localeID = "K45_VMC_DISTRICT_COLOR_LABEL";

                m_districtColor = KlyteMonoUtils.CreateColorField(mainPanel);
                m_districtColor.eventSelectedColorChanged += onChangeDistrictColor;

                KlyteMonoUtils.CreateUIElement(out UIButton resetColor, mainPanel.transform, "DistrictColorReset", new Vector4(290, 0, 0, 0));
                KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu");
                KlyteMonoUtils.LimitWidth(resetColor, 200);
                resetColor.textPadding = new RectOffset(5, 5, 5, 2);
                resetColor.autoSize    = true;
                resetColor.localeID    = "K45_VMC_RESET_COLOR";
                resetColor.eventClick += onResetColor;
            }
            ServiceSystemDefinition ssd = SingletonLite <T> .instance.GetSSD();

            IVMCDistrictExtension extension = SingletonLite <T> .instance.GetExtensionDistrict();

            KlyteMonoUtils.CreateElement(out m_assetSelectorWindow, mainPanel.transform);
            m_assetSelectorWindow.setTabContent(this);
        }
Exemple #17
0
 public override void LoadSettings() => m_redirector = KlyteMonoUtils.CreateElement <Redirector>(null, "VCE");
Exemple #18
0
        public void Awake()
        {
            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Horizontal;
            MainContainer.padding             = new RectOffset(8, 8, 8, 8);

            KlyteMonoUtils.CreateUIElement(out m_previewPanel, MainContainer.transform, "previewPanel", new UnityEngine.Vector4(0, 0, 0, 300));
            m_previewPanel.autoLayout    = true;
            m_previewPanel.disabledColor = Color.black;

            KlyteMonoUtils.CreateUIElement(out UIPanel subPreviewPanel, m_previewPanel.transform, "previewSubPanel", new UnityEngine.Vector4(0, 0, MainContainer.width - 66, m_previewPanel.height));
            subPreviewPanel.backgroundSprite = "GenericPanel";
            subPreviewPanel.autoLayout       = true;
            subPreviewPanel.disabledColor    = Color.black;


            KlyteMonoUtils.CreateUIElement(out m_preview, subPreviewPanel.transform, "preview", new UnityEngine.Vector4(0, 0, subPreviewPanel.width, subPreviewPanel.height));
            KlyteMonoUtils.CreateElement(out m_previewRenderer, MainContainer.transform);
            m_previewRenderer.Size     = m_preview.size * 2f;
            m_preview.texture          = m_previewRenderer.Texture;
            m_preview.eventMouseWheel += ChangeViewZoom;
            m_preview.eventMouseMove  += OnMouseMove;
            m_previewRenderer.Zoom     = TargetZoom;
            m_preview.disabledColor    = Color.black;

            KlyteMonoUtils.CreateUIElement(out UIPanel overrideSpriteContainer, MainContainer.transform, "overrideSpriteContainer", new UnityEngine.Vector4(0, 0, MainContainer.width - 66, 300));
            overrideSpriteContainer.autoLayout          = true;
            overrideSpriteContainer.autoLayoutDirection = LayoutDirection.Horizontal;

            KlyteMonoUtils.CreateUIElement(out UIPanel overrideSpriteSubContainer, overrideSpriteContainer.transform, "overrideSpriteSubContainer", new UnityEngine.Vector4(0, 0, overrideSpriteContainer.width, overrideSpriteContainer.height));
            overrideSpriteSubContainer.backgroundSprite    = KlyteResourceLoader.GetDefaultSpriteNameFor(LineIconSpriteNames.K45_SquareIcon, true);
            overrideSpriteSubContainer.autoLayout          = true;
            overrideSpriteSubContainer.autoLayoutDirection = LayoutDirection.Horizontal;

            OverrideSprite      = overrideSpriteSubContainer.AddUIComponent <UISprite>();
            OverrideSprite.size = overrideSpriteContainer.size;
            overrideSpriteSubContainer.isVisible = false;


            KlyteMonoUtils.CreateUIElement(out m_previewControls, MainContainer.transform, "controls", new UnityEngine.Vector4(0, 0, 50, 300));
            m_previewControls.padding             = new RectOffset(5, 5, 5, 5);
            m_previewControls.autoLayout          = true;
            m_previewControls.autoLayoutDirection = LayoutDirection.Vertical;


            KlyteMonoUtils.InitCircledButton(m_previewControls, out m_lockToSelection, CommonsSpriteNames.K45_Unlock, (x, y) => ToggleLock(), "K45_WTS_LOCK_UNLOCK_TO_CURRENT_ITEM");
            m_lockToSelection.focusedBgSprite = null;
            m_viewLocked = true;
            ToggleLock();

            KlyteMonoUtils.InitCircledButton(m_previewControls, out UIButton resetView, CommonsSpriteNames.K45_Reload, (x, y) => ResetCamera(), "K45_WTS_RESET_VIEW");

            UIHelperExtension.AddSpace(m_previewControls, 10);

            KlyteMonoUtils.InitCircledButton(m_previewControls, out UIButton useCurrentText, CommonsSpriteNames.K45_FontIcon, (x, y) => m_overrideText = null, "K45_WTS_USE_CURRENT_TEXT");
            KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use1lText, "x1", (x, y) => m_overrideText     = "1", Locale.Get("K45_WTS_USE_1LENGHT_TEXT"));
            KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use10lText, "x10", (x, y) => m_overrideText   = "Á" + new string('X', 8) + "j", Locale.Get("K45_WTS_USE_10LENGHT_TEXT"));
            KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use50lText, "x50", (x, y) => m_overrideText   = "Á" + new string('L', 48) + "j", Locale.Get("K45_WTS_USE_50LENGHT_TEXT"));
            KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use100lText, "x200", (x, y) => m_overrideText = "Á" + new string('C', 198) + "j", Locale.Get("K45_WTS_USE_200LENGHT_TEXT"));

            WTSPropLayoutEditor.Instance.CurrentTabChanged += (x) => ResetCamera();
        }