Exemplo n.º 1
0
        private UITextField CreateMiniTextField(string localeId, OnTextSubmitted onValueChanged)
        {
            UITextField ddObj = UIHelperExtension.AddTextfield(MainPanel, localeId, "", out UILabel label, out UIPanel container);

            container.autoFitChildrenHorizontally = false;
            container.autoLayoutDirection         = LayoutDirection.Horizontal;
            container.autoLayout = true;
            container.autoFitChildrenHorizontally = true;
            container.autoFitChildrenVertically   = true;

            ddObj.isLocalized         = false;
            ddObj.autoSize            = false;
            ddObj.eventTextSubmitted += (x, y) => onValueChanged(y);
            ddObj.name      = localeId;
            ddObj.size      = new Vector3(240, 22);
            ddObj.textScale = 1;


            KlyteMonoUtils.LimitWidthAndBox(label, 130);
            label.textScale         = 1;
            label.padding.top       = 4;
            label.position          = Vector3.zero;
            label.isLocalized       = true;
            label.localeID          = localeId;
            label.verticalAlignment = UIVerticalAlignment.Middle;
            label.textAlignment     = UIHorizontalAlignment.Left;

            return(ddObj);
        }
Exemplo n.º 2
0
        private UITextField CreateMiniTextField(UIComponent parent, string initVal, string name)
        {
            UITextField ddObj = UIHelperExtension.AddTextfield(parent, null, initVal, out UILabel label, out UIPanel container);

            container.autoFitChildrenHorizontally = false;
            container.autoLayoutDirection         = LayoutDirection.Horizontal;
            container.autoLayout = true;
            container.autoFitChildrenHorizontally = true;
            container.autoFitChildrenVertically   = true;
            container.padding = new RectOffset(0, 0, 3, 3);

            ddObj.isLocalized = false;
            ddObj.autoSize    = false;
            ddObj.name        = name;
            ddObj.size        = new Vector3(190, 22);
            ddObj.textScale   = 1;


            return(ddObj);
        }
Exemplo n.º 3
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            helperExtension = new UIHelperExtension((UIHelper)helper);

//			if (Singleton<SimulationManager>.instance.m_metaData != null) {
//				helperExtension.AddLabel ("Please use from Content Manager only!");
//			} else {
            creatingUI = true;

            if (firstStart)
            {
                readSettings();
            }


            checkAvailableConfigs();

            UIHelperExtension groupSave = helperExtension.AddGroupExtended("Save currently activated mods, assets and district styles");

            ((UIPanel)groupSave.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)groupSave.self).wrapLayout          = true;
            ((UIPanel)groupSave.self).width = 730;
            configNameField = (UITextField)groupSave.AddTextfield("Enter name", lastConfigName, changeConfigName, changeConfigName);
            groupSave.AddButton("Save", saveCurrentConfig);

            helperExtension.AddSpace(20);

            UIHelperExtension groupLoad = helperExtension.AddGroupExtended("Load a previously saved configuration");

            ((UIPanel)groupLoad.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)groupLoad.self).wrapLayout          = true;
            ((UIPanel)groupLoad.self).width = 700;
            configDropdown = (UIDropDown)groupLoad.AddDropdown("Pick config", availableConfigs.ToArray(), currentLoadOption, changeLoadOption);
            groupLoad.AddButton("Delete", deleteConfig);
            docVersionField = groupLoad.AddLabel("");
            groupLoad.AddSpace(20);
            groupLoad.AddButton("Apply On Game Restart", applyOnRestart);
            configRestartField           = groupLoad.AddLabel("");
            configRestartField.textColor = Color.cyan;
            groupLoad.AddSpace(20);
            UIButton applyNow = (UIButton)groupLoad.AddButton("Apply Now", applyConfig);

            configAppliedField = groupLoad.AddLabel("");
            if (Singleton <SimulationManager> .instance.m_metaData != null)
            {
                applyNow.Disable();
                configAppliedField.text      = "Available from Content Manager Only";
                configAppliedField.textColor = Color.grey;
            }
            else
            {
                configAppliedField.textColor = Color.cyan;
            }
            groupLoad.AddCheckbox("Do not affect mods status", !triggerEnableMods, changeLoadModOption);
            groupLoad.AddLabel("If you have many mods, applying the configuration immediately will cause \na long freeze. The game will be also slowed down after that. \nYou can however choose to affect the assets and district styles status only, \nwhich does not cause any perfomance issue.");
            groupLoad.AddSpace(70);
            groupLoad.AddDropdown("When finding an unlisted mod/asset :", unknownModsBehaviours, unknownModsStatus, changeUnknownModBehaviour).width = 400;

            helperExtension.AddSpace(20);

            UIHelperExtension groupListing = helperExtension.AddGroupExtended("Listing");

            ((UIPanel)groupListing.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)groupListing.self).wrapLayout          = true;
            ((UIPanel)groupListing.self).width = 730;
            ((UIPanel)groupListing.self.parent).Find <UILabel> ("Label").isVisible = false;
            statsField = groupListing.AddLabel("");
            groupListing.AddSpace(10);
            listButton = (UIButton)groupListing.AddButton("View List (slow)", updateModsList);
            groupListing.AddButton("Copy List To Clipboard", configToClipboard);
            groupListing.AddSpace(10);

            modsList = helperExtension.AddGroupExtended("Mods Listed");
            ((UIPanel)modsList.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)modsList.self).wrapLayout          = true;
            ((UIPanel)modsList.self).width = 730;

            assetsList = helperExtension.AddGroupExtended("Assets Listed");
            ((UIPanel)assetsList.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)assetsList.self).wrapLayout          = true;
            ((UIPanel)assetsList.self).width = 730;

            districtsList = helperExtension.AddGroupExtended("District Styles Listed");
            ((UIPanel)districtsList.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)districtsList.self).wrapLayout          = true;
            ((UIPanel)districtsList.self).width = 730;

            //apply restart config config
            if (firstStart)
            {
                if (startApplyConfig != null && startApplyConfig.Length > 0)
                {
                    loadModsList(startApplyConfig);
                    applyConfig();
                }
                startApplyConfig = "";

                writeSettings();

                firstStart = false;
            }

            creatingUI = false;


            //load last saved config
            int lastIndex = availableConfigs.IndexOf(lastConfigName);

            if (lastIndex >= 0)
            {
                changeLoadOption(lastIndex);
                configDropdown.selectedIndex = lastIndex;
            }
            else
            {
                changeLoadOption(0);
            }
            //}
        }