示例#1
0
    void Start()
    {
        _data = GetComponent<Dropdown>();
        if (_type == PrinterName)
        {
            if (!PrintDevice.isValid)
            {
                throw new NotSupportedException("認識できるプリンターがありません");
            }
            var printer = PrintDevice.GetPrinterNames().GetEnumerator();
            while (printer.MoveNext())
            {
                _item = new Dropdown.OptionData();
                _item.text = printer.Current;
                _data.options.Add(_item);
            }
            _data.captionText.text = _data.options[0].text;

        }
        else if (_type == PrinterColor)
        {
            var color = _offScreenCamera.GetComponent<Grayscale>();
            if (_data.value == 0)
            {
                _printColor = PrintDevice.GetPrinterColorConfig(true);
                color.enabled = false;
            }
            else if (_data.value == 1)
            {
                _printColor = PrintDevice.GetPrinterColorConfig(false);
                color.enabled = true;
            }
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        canzoneInEsecuzioneText.text = audioSource.clip.ToString();

        for(int i = 0; i < numeroOggetti; i++)
        {
            tmpCubo = Instantiate(oggetto, cameraPrincipale.ScreenToWorldPoint(new Vector3(((float)i*Screen.width/numeroOggetti), Screen.height*coordinataInBasso, 20f)), Quaternion.identity) as GameObject;
            oggetti.Add(tmpCubo);
        }

        dropDownFinestre.options.Clear();
        for (int i = 0; i < nomeFinestraSpettro.Length; i++)
        {
            Dropdown.OptionData opzione = new Dropdown.OptionData();
            opzione.text= nomeFinestraSpettro[i].ToString();
            dropDownFinestre.options.Add(opzione);
        }
        dropDownFinestre.value = 0;

        dropdownOnOff.options.Clear();
        for (int i = 0; i < cosaVisualizzo.Length; i++)
        {
            Dropdown.OptionData opzione = new Dropdown.OptionData();
            opzione.text = cosaVisualizzo[i].ToString();
            dropdownOnOff.options.Add(opzione);
        }
        dropdownOnOff.value = 0;

        guiRectTransform = Gui.GetComponent<RectTransform>();
        guiRectTransform.localPosition = new Vector3(0f,0f,0f);
    }
		public QuickImportOption(string _name){
			option_name = _name;
			dropdown_option = new Dropdown.OptionData();
			
			rx_display_text = LanguageController.controller.rx_get_filename_label(_name);
			
			sub = rx_display_text.Subscribe(t=>{
				dropdown_option.text = t;
			});
		}
示例#4
0
	void FlushDropList()
	{
		var list = new List<Dropdown.OptionData>();
		foreach (var d in Game.Dumps)
		{
			var o = new Dropdown.OptionData();
			o.text = (null == d) ? "Classic" : d.name;
			list.Add(o);
		}
		dropdown.options = list;
	}
 void Start()
 {
     List<Dropdown.OptionData> typeOptions = new List<Dropdown.OptionData>();
     foreach(HexTileTypes tileType in HexTileTypes.GetValues(typeof(HexTileTypes)))
     {
         Dropdown.OptionData newOption = new Dropdown.OptionData();
         newOption.text = tileType.ToString();
         typeOptions.Add(newOption);
     }
     typeDropdown.AddOptions(typeOptions);
     typeDropdown.onValueChanged.AddListener(delegate { onTypeValueChanged(typeDropdown); });
 }
示例#6
0
        void Init()
        {
            fieldType = typeof(KeyCode);

            dropdown.options.Clear();
            foreach (var value in Enum.GetValues(fieldType)) {
            var item = new Dropdown.OptionData();
            item.text = value.ToString();
            dropdown.options.Add(item);
            }
            dropdown.captionText.text = dropdown.options[dropdown.value].text;
        }
 // Use this for initialization
 void Start()
 {
     dropdown = GetComponent<Dropdown>();
     int i = 0;
     foreach (Resolution res in Screen.resolutions) {
         Dropdown.OptionData opt = new Dropdown.OptionData();
         opt.text = res.ToString().Split('@')[0];
         dropdown.options.Add(opt);
         if (Screen.currentResolution.ToString() == res.ToString())
             dropdown.gameObject.transform.GetChild(0).GetComponent<Text>().text = res.ToString().Split('@')[0];
         i++;
     }
 }
示例#8
0
    private void CreateEditPetScrollView()
    {
        RectTransform contentRectTransform = null;
        RectTransform[] allRectTransforms = EditPetScrollView.GetComponentsInChildren<RectTransform>();

        for(int rectIndex = 0; rectIndex < allRectTransforms.Length; ++rectIndex)
        {
            if(allRectTransforms[rectIndex].name == "Content")
            {
                contentRectTransform = allRectTransforms[rectIndex];
            }
        }

        MurpleEntry.AddUIElement(MurpleUIElement.Type.InputField, "UUID", contentRectTransform);

        Murple.Definition definition = MurpleEntry.MurpleControl.GetMurpleDefinition(PodTypeName);
        foreach (KeyValuePair<string, Murple.StatBase> thisPair in definition.Definitions)
        {
            string thisStatName = thisPair.Key;
            Murple.StatBase thisStat = thisPair.Value;

            if(thisStat.IsStatType(Murple.StatHelper.StatType.String) == true)
            {
                MurpleEntry.AddUIElement(MurpleUIElement.Type.InputField, thisStatName, contentRectTransform);
            }
            else if (thisStat.IsStatType(Murple.StatHelper.StatType.DatabaseType) == true)
            {
                MurpleUIElement uiElement = MurpleEntry.AddUIElement(MurpleUIElement.Type.Dropdown, thisStatName, contentRectTransform);
                Dropdown uiDropdown = (Dropdown)uiElement.UIElement;

                Murple.Database.DatabaseType databaseValue = (Murple.Database.DatabaseType)thisStat.Get();
                string databaseName = databaseValue.mDatabaseName;

                Murple.Database database = MurpleEntry.MurpleControl.GetDatabase("RatApp");
                int dataValueCount = database.GetDataCountInGroup(databaseValue.mGroupIndex);

                uiDropdown.options.Clear();
                for (int dataIndex = 0; dataIndex < dataValueCount; ++dataIndex)
                {
                    string dataValue = database.GetDataInGroup(databaseValue.mGroupIndex, dataIndex);
                    Dropdown.OptionData newOption = new Dropdown.OptionData(dataValue);
                    uiDropdown.options.Add(newOption);
                }
            }

        }

        MurpleEntry.SortUIElemnts(contentRectTransform);
    }
示例#9
0
 public void Init(CUIPanel oCanvas, CProp oProp, FieldInfo[] aFieldsEnum)
 {
     _oTextLabel = transform.GetChild(0).GetComponent<Text>();           // Label is always first child of prefab
     _oDropdown  = transform.GetChild(1).GetComponent<Dropdown>();       // Dropdown is always 2nd child of prefab
     //_oDropdown.options.RemoveAll();
     foreach (FieldInfo oFieldInfo in aFieldsEnum) {
         if (oFieldInfo.Name != "value__") {               // Enums have a hidden 'value__' entry.  Don't add it to drop box...
             Dropdown.OptionData oOptData = new Dropdown.OptionData(oFieldInfo.Name);
             _oDropdown.options.Add(oOptData);
         }
     }
     base.Init(oCanvas, oProp);
     _oDropdown.value = -1;                  //###LEARN: Original setting of drop down won't 'take' if we first don't set to other value than start value.
     base.Init(oCanvas, oProp);              //###WEAK: We must init twice for above call to work
 }
示例#10
0
    /**
    * Método que busca todos os usuários que estão cadastrados no banco de dados.
    * Retorna uma lista de objetos que podem ser inseridos no Dropdown de selecionar os jogadores.
    **/
    public static System.Collections.Generic.List<Dropdown.OptionData> gerarListaUsuarios(UsuarioDao usuarioDao)
    {
        System.Collections.Generic.List<Usuario> listaUsuarios = usuarioDao.consultarUsuario();

        Dropdown.OptionData primeiroItem = new Dropdown.OptionData("Selecione o Jogador");
        System.Collections.Generic.List<Dropdown.OptionData> listaDropDown = new System.Collections.Generic.List<Dropdown.OptionData>();
        listaDropDown.Add(primeiroItem);

        foreach (Usuario u in listaUsuarios)
        {
            Dropdown.OptionData item = new Dropdown.OptionData(u.nome);
            listaDropDown.Add(item);
        }

        return listaDropDown;
    }
示例#11
0
        private void SetupDropdownOptions()
        {
            var options = new List <Dropdown.OptionData>();
            IList <MicrogridVar> activeVars = GetActiveVars(gSubscriber.Links);

            foreach (MicrogridVar mvar in descriptionDict.Keys)
            {
                Sprite s           = activeVars.Contains(mvar) ? activeSprite : inactiveSprite;
                string description = descriptionDict[mvar];
                var    newOption   = new Dropdown.OptionData(description, s);
                options.Add(newOption);
                optionDict.Add(newOption, mvar);
            }

            dropdown.ClearOptions();
            dropdown.AddOptions(options);
        }
示例#12
0
    void Start()
    {
        foreach (string temp in this.MsgCenter.FengGe.Keys)
        {
            Dropdown.OptionData op = new Dropdown.OptionData();
            op.text = temp;

            D_FengGe.options.Add(op);
        }
        foreach (string temp in this.MsgCenter.SceneStyle.Keys)
        {
            Dropdown.OptionData op = new Dropdown.OptionData();
            op.text = temp;

            D_SceneStyle.options.Add(op);
        }
    }
示例#13
0
    void Awake()
    {
        var os = new List <Dropdown.OptionData>();

        foreach (var pc in PlayerCharacters.Singleton.Entries.Where(x => x.id != 0))
        {
            var o = new Dropdown.OptionData {
                text = pc.name
            };
            os.Add(o);
        }
        Characters.options = os;
        if (Characters.options.Count > 0)
        {
            PlayerCharacters.Singleton.ChangeCharacter(1);
        }
    }
示例#14
0
    public void GetPort()
    {
        string[] str = null;
        GameManager.SearchCom(ref str);

        if (str.Length > 0)
        {
            drop.options.Clear();
            foreach (string str2 in str)
            {
                Dropdown.OptionData option = new Dropdown.OptionData();
                option.text = str2;
                drop.options.Add(option);
                //제일 처음에 위치한 녀석을 선택
            }
        }
    }
示例#15
0
        public static IDisposable BindOptionsTo <T>(this Dropdown input, IReactiveCollection <T> options, Func <T, string> textLocator, Func <T, Sprite> spriteLocator = null)
        {
            var addSubscription = options.ObserveAdd().Subscribe(x =>
            {
                var newOption = new Dropdown.OptionData {
                    text = textLocator(x.Value)
                };
                if (spriteLocator != null)
                {
                    newOption.image = spriteLocator(x.Value);
                }

                input.options.Insert(x.Index, newOption);
            });

            var updateSubscription = options.ObserveReplace().Subscribe(x =>
            {
                var existingOption  = input.options[x.Index];
                existingOption.text = textLocator(x.NewValue);

                if (spriteLocator != null)
                {
                    existingOption.image = spriteLocator(x.NewValue);
                }
            });

            var removeSubscription = options.ObserveRemove().Subscribe(x => input.options.RemoveAt(x.Index));

            input.options.Clear();

            foreach (var option in options)
            {
                var newOption = new Dropdown.OptionData {
                    text = textLocator(option)
                };

                if (spriteLocator != null)
                {
                    newOption.image = spriteLocator(option);
                }

                input.options.Add(newOption);
            }

            return(new CompositeDisposable(addSubscription, updateSubscription, removeSubscription).AddTo(input));
        }
    public void CreateMachineContents()
    {
        Dropdown.OptionData machineData;

        Dropdown.OptionData registOption = new Dropdown.OptionData {
            text = "機種を選択"
        };                                                                                // 新規登録を追加
        m_MachineDropDown.options.Add(registOption);
        foreach (var machine in m_DatabaseController.SelectMachineMaster())
        {
            machineData = new DropDownOptionDataExtends <AmusumentMachineMasterData>()
            {
                Data = machine, text = machine.machineName
            };
            m_MachineDropDown.options.Add(machineData);
        }
    }
    private void FillDropdown()
    {
        // fill dropdown with destinations
        destDropdown.ClearOptions();
        List <Dropdown.OptionData> items = new List <Dropdown.OptionData>();

        foreach (OrbitEllipse oe in destinations)
        {
            if (oe.gameObject != fromNbody.gameObject)
            {
                Dropdown.OptionData item = new Dropdown.OptionData();
                item.text = oe.gameObject.name;
                items.Add(item);
            }
        }
        destDropdown.AddOptions(items);
    }
    private void Start()
    {
        _mapController         = MapController.Instance();
        _previewSpriteRenderer = buildingController.preview.GetComponent <SpriteRenderer>();
        buildingController.SetBuildingUIController(this);
        var options = new List <Dropdown.OptionData>();

        foreach (var name in _mapController.FurnituresNames)
        {
            var option = new Dropdown.OptionData();
            option.text = FormatControlName(name);
            options.Add(option);
        }

        FurnitureSelection.options = options;
        FurnitureSelection.onValueChanged.AddListener(delegate { DropdownValueChanged(); });
    }
示例#19
0
        public void AddDropdownItem(string text, string imagePath = "")
        {
            InitDropdown();

            var data = new Dropdown.OptionData();

            data.text = text;
            if (!string.IsNullOrEmpty(imagePath))
            {
                var sprite = CommonUtil.AssetTrackMgr.GetAsset <Sprite>(imagePath);
                if (null != sprite)
                {
                    data.image = sprite;
                }
            }
            dropdown.options.Add(data);
        }
    void SetupAbilitiesDropDownMenu()
    {
        abilityDropDownMenu.value = 0;
        List <Dropdown.OptionData> newOptions = new List <Dropdown.OptionData>();

        foreach (var ability in currentTurnTaker.abilities)
        {
            Dropdown.OptionData newOption = new Dropdown.OptionData(ability.aName);
            if (ability.aSprite != null)
            {
                newOption.image = ability.aSprite;
            }
            newOptions.Add(newOption);
        }
        abilityDropDownMenu.options = newOptions;
        abilityDropDownMenu.RefreshShownValue();
    }
示例#21
0
 // Start is called before the first frame update
 void Start()
 {
     selectedItem = null;
     dropdown.options.Clear();
     for (int i = 0; i < 2; i++)
     {
         foreach (BugType bug in Enum.GetValues(typeof(BugType)))
         {
             Dropdown.OptionData option1 = new Dropdown.OptionData();
             option1.text = (i == 0 ? "White" : "Black") + " " + bug.ToString();
             dropdown.options.Add(option1);
         }
     }
     Dropdown.OptionData option = new Dropdown.OptionData();
     option.text = "(+) Add piece...";
     dropdown.options.Add(option);
 }
        private void CreateFilters(string[] filters)
        {
            filterDropdown.options.Clear();

            for (int i = 0; i < filters.Length; i++)
            {
                if (filters[i][0] != '.')
                {
                    filters[i] = '.' + filters[i];
                }

                Dropdown.OptionData data = new Dropdown.OptionData(filters[i]);
                filterDropdown.options.Add(data);
            }

            this.filters = filters;
        }
    public static int get_image(IntPtr l)
    {
        int result;

        try
        {
            Dropdown.OptionData optionData = (Dropdown.OptionData)LuaObject.checkSelf(l);
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, optionData.image);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
示例#24
0
 private void UpdateDrawDownItem(List <string> showNames)
 {
     dropdown.options.Clear();
     Dropdown.OptionData itemData;
     for (int i = 0; i < showNames.Count; i++)
     {
         //为每一个option赋值
         itemData       = new Dropdown.OptionData();
         itemData.text  = showNames[i];
         itemData.image = sprite_list[i];
         dropdown.options.Add(itemData);
     }
     //dropdown初始的选项
     dropdown.captionText.text = showNames[0];
     other_img.sprite          = sprite_list[0];
     dropdown.captionImage     = other_img;
 }
    public void DisplayBuildings()
    {
        var dropdown = FindObjectOfType <Dropdown>();
        var options  = new List <Dropdown.OptionData>();

        foreach (var building in Base.Buildings)
        {
            var option = new Dropdown.OptionData
            {
                text = building.ToString()
            };

            options.Add(option);
        }

        dropdown.AddOptions(options);
    }
示例#26
0
 public void Refresh()
 {
     foreach (Dropdown d in modSlots)
     {
         d.ClearOptions();
         Dropdown.OptionData entry = new Dropdown.OptionData();
         entry.text = "No mod";
         d.options.Add(entry);
         foreach (Mod mod in modList)
         {
             entry      = new Dropdown.OptionData();
             entry.text = mod.modString;
             d.options.Add(entry);
         }
         d.RefreshShownValue();
     }
 }
示例#27
0
 void Awake()
 {
     if (ProfilesDropdown != null)
     {
         var os = new List <Dropdown.OptionData>();
         foreach (var pc in PlayerCharacters.Singleton.Entries.Where(x => x.id != 0))
         {
             var o = new Dropdown.OptionData {
                 text = pc.name
             };
             os.Add(o);
         }
         ProfilesDropdown.options = os;
         ProfilesDropdown.value   = PlayerCharacters.Singleton.CurrentCharacter.Data.Id - 1;
     }
     RebuildSaves();
 }
示例#28
0
    /// <summary>
    ///
    /// </summary>
    private void Awake()
    {
        int cid = bl_Localization.Instance.LoadStoreLanguage(true);

        m_Dropdown.ClearOptions();
        List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

        for (int i = 0; i < bl_Localization.Instance.Languages.Length; i++)
        {
            Dropdown.OptionData o = new Dropdown.OptionData();
            o.text  = bl_Localization.Instance.Languages[i].Text.LanguageName.ToUpper();
            o.image = bl_Localization.Instance.Languages[i].Text.LanguageIcon;
            options.Add(o);
        }
        m_Dropdown.AddOptions(options);
        m_Dropdown.value = cid;
    }
示例#29
0
    private Dropdown.OptionData[] CreateDeviceDropdown()
    {
        Dropdown.OptionData[] options = new Dropdown.OptionData[WorldController.Instance.soundController.GetDriverCount()];

        for (int i = 0; i < options.Length; i++)
        {
            DriverInfo info = WorldController.Instance.soundController.GetDriverInfo(i);

            options[i] = new DriverDropdownOption
            {
                text       = info.name.ToString(),
                driverInfo = info.guid.ToString()
            };
        }

        return(options);
    }
        private void UpdateColorDropdownOptions()
        {
            _colorDropdown.onValueChanged.RemoveAllListeners();
            BulletStyleCfg bulletCfg = DatabaseManager.BulletDatabase.GetBulletStyleCfgByStyleId(_styleIndex);

            _colorList = bulletCfg.availableColors;
            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

            for (int i = 0; i < _colorList.Count; i++)
            {
                ColorCfg            colorCfg   = DatabaseManager.BulletDatabase.GetColorCfgByColorId(_colorList[i]);
                Dropdown.OptionData optionData = new Dropdown.OptionData(colorCfg.colorName);
                options.Add(optionData);
            }
            _colorDropdown.options = options;
            _colorDropdown.onValueChanged.AddListener(OnColorDropdownValueChangedHandler);
        }
示例#31
0
    public void SetOptions()
    {
        //Because OnEnable is called before start, in order to prevent errors, we first have to check if the values in start have been set yet.

        if (taskManager != null)
        {
            thisDropdown.ClearOptions();

            foreach (TaskManager.Subject eachSubject in taskManager.subjects)
            {
                Dropdown.OptionData newData = new Dropdown.OptionData(eachSubject.subjectName);
                thisDropdown.options.Add(newData);
            }

            thisDropdown.RefreshShownValue();
        }
    }
示例#32
0
 void flagList()
 {
     for (int i = 0; i < 1; i++)
     {
         string flagName = (names[i]);
         foreach (var flag in flags)
         {
             flag.name = flagName;
             var flagOption = new Dropdown.OptionData(flag.name, flag);
             flagItems.Add(flagOption);
             flagName  = (names[i + 1]);
             flag.name = flagName;
             i         = i + 1;
         }
         dropDown.AddOptions(flagItems);
     }
 }
    void Start()
    {
        dropdown.ClearOptions();

        List <Dropdown.OptionData> flagItems = new List <Dropdown.OptionData>();

        foreach (var flag in flags)
        {
            var flagOption = new Dropdown.OptionData(flag.name, flag);
            flagItems.Add(flagOption);
        }


        dropdown.AddOptions(flagItems);

        dropdown.value = Parameters.track - 1;
    }
    // Start is called before the first frame update
    void Start()
    {
        dropdown = GetComponent <Dropdown>();

        List <Dropdown.OptionData> list = new List <Dropdown.OptionData>();

        for (int i = 0; i < colors.Length; i++)
        {
            var texture = new Texture2D(1, 1);
            texture.SetPixel(0, 0, colors[i]);
            texture.Apply();
            var item = new Dropdown.OptionData(Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0)));
            dropdown.options.Add(item);
        }
        dropdown.captionImage.sprite  = dropdown.options[0].image;
        dropdown.captionImage.enabled = true;
    }
示例#35
0
    public void DrowdownAddOptions(string icon, string iconClass, Dropdown dropdown)
    {
        Sprite sprite;

        if (icon == "")
        {
            sprite = new Sprite();
        }
        else
        {
            sprite = (Sprite)spriteTable[int.Parse(icon)];
        }
        Dropdown.OptionData item = new Dropdown.OptionData(iconClass, sprite);
        dropdown.AddOptions(new List <Dropdown.OptionData> {
            item
        });
    }
示例#36
0
    private void Start()
    {
        Resolution[] resolution;
        resolution = Screen.resolutions;

        res.onValueChanged.AddListener(delegate { Screen.SetResolution(resolution[res.value].width, resolution[res.value].height, Screen.fullScreen); });

        for (int i = 0; i < resolution.Length; i++)
        {
            Dropdown.OptionData addedData = new Dropdown.OptionData(ResToString(resolution[i]));
            res.options.Add(addedData);
        }

        qSlider.maxValue = 6;
        qSlider.minValue = 1;
        QualitySettings.SetQualityLevel(0);
    }
示例#37
0
        /// <summary>
        /// Refreshes all elements on the song arranger UI.
        /// </summary>
        public void Refresh()
        {
            // Update the options in the dropdown to include all riffs
            _dropdown.ClearOptions();
            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();

            foreach (Riff riff in MusicManager.Instance.CurrentSong.Riffs)
            {
                Sprite sprite = riff.Instrument.Icon;
                Dropdown.OptionData option = new Dropdown.OptionData(riff.Name, sprite);
                options.Add(option);
            }
            _dropdown.AddOptions(options);

            if (MusicManager.Instance.CurrentSong.Riffs.Count == 0)
            {
                _dropdown.interactable = false;
                _editRiffButton.GetComponent <Button>().interactable    = false;
                _playRiffButton.GetComponent <Button>().interactable    = false;
                _previewSongButton.GetComponent <Button>().interactable = false;
            }
            else
            {
                _dropdown.interactable = true;
                _editRiffButton.GetComponent <Button>().interactable    = true;
                _playRiffButton.GetComponent <Button>().interactable    = true;
                _previewSongButton.GetComponent <Button>().interactable = true;
                if (RiffEditor.CurrentRiff == null)
                {
                    RiffEditor.CurrentRiff = MusicManager.Instance.CurrentSong.Riffs[0];
                }
            }

            _dropdown.value = _selectedRiffIndex;

            // Refresh song name input field
            _songNameInputField.text = MusicManager.Instance.CurrentSong.Name;

            // Update play riff button art
            _playRiffButton.GetComponent <Image>().sprite = UIManager.Instance.PlayIcon;

            bool hasRiffs = MusicManager.Instance.CurrentSong.Riffs.Count != 0;

            SongTimeline.Instance.SetInteractable(hasRiffs);
            _addRiffReminder.SetActive(!hasRiffs);
        }
示例#38
0
    void SetDropdownMenu()
    {
        resDropdown.options = new System.Collections.Generic.List <Dropdown.OptionData>();

        for (int i = 0; i < resolutionsList.Length; i++)
        {
            Dropdown.OptionData option = new Dropdown.OptionData();
            option.text = resolutionsList[i].width + " x " + resolutionsList[i].height;
            resDropdown.options.Add(option);
        }

        currentResolution.text = Screen.width + " x " + Screen.height;

        resDropdown.value = resolutionsList_id;
        resDropdown.onValueChanged.AddListener(delegate { ApplyResolution(); });
        fullscreenToggle.onValueChanged.AddListener(delegate { ApplyResolution(); });
    }
示例#39
0
    // Update is called once per frame
    void Update()
    {
        if (Microphone.devices.Length == 0 && _toggleUseMicrophone.interactable == true)
        {
            _toggleUseMicrophone.interactable = false;
            _toggleUseMicrophone.isOn         = false;
            _audioPeer._useMicrophone         = false;
        }
        if (Microphone.devices.Length > 0 && _toggleUseMicrophone.interactable == false)
        {
            _toggleUseMicrophone.interactable = true;
        }


        for (int i = _dropdownSelectMicInput.options.Count; i < Microphone.devices.Length; i++)
        {
            Dropdown.OptionData _listItem = new Dropdown.OptionData(Microphone.devices [0].ToString());
            _dropdownSelectMicInput.options.Add(_listItem);
        }
        for (int i = 0; i < Microphone.devices.Length; i++)
        {
            _dropdownSelectMicInput.options[i] = new Dropdown.OptionData(Microphone.devices [i].ToString());
        }
        if (_dropdownSelectMicInput.options.Count > Microphone.devices.Length)
        {
            _dropdownSelectMicInput.options.RemoveAt(0);
        }

        if ((_audioPeer._useMicrophone) && (_dropdownSelectMicInput.interactable == false))
        {
            _dropdownSelectMicInput.interactable = true;
        }
        if ((!_audioPeer._useMicrophone) && (_dropdownSelectMicInput.interactable == true))
        {
            _dropdownSelectMicInput.interactable = false;
        }
        if (_toggleUseMicrophone.isOn != _audioPeer._useMicrophone)
        {
            _audioPeer._useMicrophone = _toggleUseMicrophone.isOn;
        }

        if (_audioPeer.selectedDevice != _dropdownSelectMicInput.options[_dropdownSelectMicInput.value].text.ToString())
        {
            _audioPeer.selectedDevice = _dropdownSelectMicInput.options[_dropdownSelectMicInput.value].text.ToString();
        }
    }
 // Use this for initialization
 void Start()
 {
     Owner = GetComponentInParent <CombatChar>();
     // Dropdown.OptionData op = new Dropdown.OptionData();
     // op.text = "coco";
     // targetTab.options.Add(op);
     foreach (string target in Enum.GetNames(typeof(CombatManager.Targets)))
     {
         Dropdown.OptionData op = new Dropdown.OptionData();
         op.text  = target;
         op.image = null;
         targetTab.options.Add(op);
     }
     targetTab.RefreshShownValue();
     foreach (string test in Enum.GetNames(typeof(CombatAI.AITests)))
     {
         Dropdown.OptionData op = new Dropdown.OptionData();
         op.text  = test;
         op.image = null;
         testTab.options.Add(op);
     }
     testTab.RefreshShownValue();
     foreach (string condition in Enum.GetNames(typeof(CombatAI.AIConditions)))
     {
         Dropdown.OptionData op = new Dropdown.OptionData();
         op.text  = condition;
         op.image = null;
         conditionTab.options.Add(op);
     }
     foreach (string value in Enum.GetNames(typeof(CombatAI.AIValues)))
     {
         Dropdown.OptionData op = new Dropdown.OptionData();
         op.text  = value;
         op.image = null;
         valueTab.options.Add(op);
     }
     conditionTab.RefreshShownValue();
     foreach (string power in Owner.C.knownPowers.Keys)
     {
         Dropdown.OptionData op = new Dropdown.OptionData();
         op.text  = power;
         op.image = null;
         powerTab.options.Add(op);
     }
     powerTab.RefreshShownValue();
 }
示例#41
0
    private void LoadMenuItems ()
    {
        List<CustomMenuItem> fileMenu = new List<CustomMenuItem>();
        fileMenu.Add(new CustomMenuItem("New Map", "newMap"));
        fileMenu.Add(new CustomMenuItem("Load Map", "loadMap"));
        fileMenu.Add(new CustomMenuItem("Save Map", "saveMap"));
        fileMenu.Add(new CustomMenuItem("Clear Map", "clearMap"));
        fileMenu.Add(new CustomMenuItem("Exit", "exitEditor"));

        menuItemsData.Add(fileMenu);

        List<Dropdown.OptionData> typeOptions = new List<Dropdown.OptionData>();
        int index = 0;

        foreach (CustomMenuItem menuItem in fileMenu)
        {
            Dropdown.OptionData newOption = new Dropdown.OptionData();
            newOption.text = menuItem.MenuLabelText;
            typeOptions.Add(newOption);
            index++;
        }
        menuDropDowns[0].AddOptions(typeOptions);
        menuDropDowns[0].onValueChanged.AddListener(delegate { onMenuItemSelect(menuDropDowns[0], fileMenu[menuDropDowns[0].value]); });

        List<CustomMenuItem> selectMenu = new List<CustomMenuItem>();
        selectMenu.Add(new CustomMenuItem("Select All", "selectAll"));
        selectMenu.Add(new CustomMenuItem("Select Neighboring", "selectNeighboring"));
        selectMenu.Add(new CustomMenuItem("Select None", "selectNone"));

        menuItemsData.Add(fileMenu);

        typeOptions = new List<Dropdown.OptionData>();
        index = 0;

        foreach (CustomMenuItem menuItem in selectMenu)
        {
            Dropdown.OptionData newOption = new Dropdown.OptionData();
            newOption.text = menuItem.MenuLabelText;
            typeOptions.Add(newOption);
            index++;
        }
        menuDropDowns[1].AddOptions(typeOptions);
        menuDropDowns[1].onValueChanged.AddListener(delegate { onMenuItemSelect(menuDropDowns[1], selectMenu[menuDropDowns[1].value]); });

    }
    // Use this for initialization
    void Awake()
    {
        if (Instance != null && Instance != this) {
            //destroy other instances
            Destroy(gameObject);
            return;
        }

        //Singleton instance
        Instance = this;

        //on't destroy between scenes
        DontDestroyOnLoad(gameObject);

        if (SourceFile == null) {
            this.enabled = false;
            return;
        }
        _localizationDictionary = new Dictionary<string, Dictionary<string, string>>();

        UpdateDictionary();

        //new List<MainMenu_Settings>(Resources.FindObjectsOfTypeAll<MainMenu_Settings>()).ForEach(i => i.gameObject.SetActive(true));

        var dropdownObject = new List<Dropdown>(Resources.FindObjectsOfTypeAll<Dropdown>()).Find(i => i.name == "LanguageSelect");
        if (dropdownObject == null) {
            Debug.LogError("Localization::UpdateLocalization >> Make sure the languageSelect dropdown is called \"LanguageSelect\"");
            CurrentLanguage = "English";
        } else {
            dropdownObject.options.Clear();
            foreach (var key in _localizationDictionary.Keys) {
                Dropdown.OptionData data = new Dropdown.OptionData(key);
                dropdownObject.options.Add(data);
            }

            CurrentLanguage = dropdownObject.options[PlayerPrefs.GetInt("Language")].text;
        }
        dropdownObject.value = PlayerPrefs.GetInt("Language");

        //        new List<MainMenu_Settings>(Resources.FindObjectsOfTypeAll<MainMenu_Settings>()).ForEach(i => i.gameObject.SetActive(false));

        UpdateLocalization();
    }
示例#43
0
    // Use this for initialization
    void Start()
    {
        puertos = obtenerPuertos();

        if (puertos.Length == 0)
        {
            Debug.Log("No se detectaron puertos abiertos...");
        }

        for (int i = 0; i < puertos.Length; i++)
        {
            Dropdown.OptionData item = new Dropdown.OptionData(puertos[i]);
            puertos_gui.options.Add(item);
        }

        Dropdown.OptionData[] datos = puertos_gui.options.ToArray();
        puertos = new string[datos.Length];
        for (int i = 0; i < datos.Length; i++)
            puertos[i] = datos[i].text;
    }
示例#44
0
 void Awake()
 {
     if (resolutions == null)
     {
         resolutions = Screen.resolutions;
         CurrentResolution = getScreenResolution();
         fullScreen = Screen.fullScreen;
     }
     List<Dropdown.OptionData> listResolutions = new List<Dropdown.OptionData>();
     foreach (Resolution res in resolutions)
     {
         Dropdown.OptionData data = new Dropdown.OptionData(res.ToString());
         listResolutions.Add(data);
     }
     resolutionObjects.resolutionDropdown.ClearOptions();
     resolutionObjects.resolutionDropdown.AddOptions(listResolutions);
     setFullScreen(fullScreen);
     setFieldOfView(playerCamera.fieldOfView);
     setSensitivity(playerScript.cameraRotator.horizontalSensitivity, playerScript.cameraRotator.verticalSensitivity);
     gameObject.SetActive(false);
 }
 public void ChangeDropdowns()
 {
     dropdownPointsSquare.GetComponent<Dropdown>().ClearOptions();
     dropdownPointsCircle.GetComponent<Dropdown>().ClearOptions();
     dropdownSquare.GetComponent<Dropdown>().ClearOptions();
     dropdownCircle.GetComponent<Dropdown>().ClearOptions();
     //Refresh Point Lists
     Dropdown.OptionData dropdownPointList = new Dropdown.OptionData();
     if (pointList.Count > 0) {
         dropdownPointsSquare.GetComponent<Dropdown>().value = 0;
         dropdownPointsCircle.GetComponent<Dropdown>().value = 0;
         foreach (Punto point in pointList) {
             dropdownPointList = new Dropdown.OptionData(point.ToString());
             dropdownPointsSquare.GetComponent<Dropdown>().options.Add(dropdownPointList);
             dropdownPointsSquare.GetComponent<Dropdown>().RefreshShownValue();
             dropdownPointsCircle.GetComponent<Dropdown>().options.Add(dropdownPointList);
             dropdownPointsCircle.GetComponent<Dropdown>().RefreshShownValue();
         }
     }
     //Refresh Square Lists
     Dropdown.OptionData dropdownSquareList = new Dropdown.OptionData();
     if (squareList.Count > 0) {
         dropdownSquare.GetComponent<Dropdown>().value = 0;
         foreach (FiguraGeometrica square in squareList) {
             dropdownSquareList = new Dropdown.OptionData(square.Dibujar());
             dropdownSquare.GetComponent<Dropdown>().options.Add(dropdownSquareList);
             dropdownSquare.GetComponent<Dropdown>().RefreshShownValue();
         }
     }
     //Refresh Circle Lists
     Dropdown.OptionData dropdownCircleList = new Dropdown.OptionData();
     if (circleList.Count > 0) {
         dropdownCircle.GetComponent<Dropdown>().value = 0;
         foreach (FiguraGeometrica circle in circleList) {
             dropdownCircleList = new Dropdown.OptionData(circle.Dibujar());
             dropdownCircle.GetComponent<Dropdown>().options.Add(dropdownCircleList);
             dropdownCircle.GetComponent<Dropdown>().RefreshShownValue();
         }
     }
 }
示例#46
0
	public void Init(){

		Instance = this;

        foreach (SettingSlider slider in Sliders) {
            slider.Init();
        }

        Drop.options.Clear ();

		foreach(KeyValuePair<Settings.SettingsTypes, Settings.Setting> setting in Settings.Instance.SettingsDict){
			Dropdown.OptionData item = new Dropdown.OptionData();
			item.text = setting.Value.Title;
			Drop.options.Add(item);
			_settingsList.Add(setting.Value);
		}

		Drop.value = 1;
		Drop.value = 0;
		
        
	}
示例#47
0
    // Use this for initialization
    void Start()
    {
        puertos = obtenerPuertos();

        if (puertos.Length == 0)
        {
            Debug.Log("No se detectaron puertos abiertos...");
        }

        for (int i = 0; i < puertos.Length; i++)
        {
            Dropdown.OptionData item = new Dropdown.OptionData(puertos[i]);
            puertos_gui.options.Add(item);
        }

        Dropdown.OptionData[] datos = puertos_gui.options.ToArray();
        puertos = new string[datos.Length];
        for (int i = 0; i < datos.Length; i++)
            puertos[i] = datos[i].text;

        if (PlayerPrefs.HasKey(Estado.PUERTO) &&
            puertos_gui.options.Exists(opt => opt.text == PlayerPrefs.GetString(Estado.PUERTO)))
            puertos_gui.value = puertos_gui.options.FindIndex(opt => opt.text == PlayerPrefs.GetString(Estado.PUERTO));
    }
 public static GameObject CreateDropdown(Resources resources)
 {
     GameObject parent = CreateUIElementRoot("Dropdown", s_ThickElementSize);
     GameObject obj3 = CreateUIObject("Label", parent);
     GameObject obj4 = CreateUIObject("Arrow", parent);
     GameObject obj5 = CreateUIObject("Template", parent);
     GameObject obj6 = CreateUIObject("Viewport", obj5);
     GameObject obj7 = CreateUIObject("Content", obj6);
     GameObject obj8 = CreateUIObject("Item", obj7);
     GameObject obj9 = CreateUIObject("Item Background", obj8);
     GameObject obj10 = CreateUIObject("Item Checkmark", obj8);
     GameObject obj11 = CreateUIObject("Item Label", obj8);
     GameObject child = CreateScrollbar(resources);
     child.name = "Scrollbar";
     SetParentAndAlign(child, obj5);
     Scrollbar component = child.GetComponent<Scrollbar>();
     component.SetDirection(Scrollbar.Direction.BottomToTop, true);
     RectTransform transform = child.GetComponent<RectTransform>();
     transform.anchorMin = Vector2.right;
     transform.anchorMax = Vector2.one;
     transform.pivot = Vector2.one;
     transform.sizeDelta = new Vector2(transform.sizeDelta.x, 0f);
     Text lbl = obj11.AddComponent<Text>();
     SetDefaultTextValues(lbl);
     lbl.alignment = TextAnchor.MiddleLeft;
     Image image = obj9.AddComponent<Image>();
     image.color = (Color) new Color32(0xf5, 0xf5, 0xf5, 0xff);
     Image image2 = obj10.AddComponent<Image>();
     image2.sprite = resources.checkmark;
     Toggle toggle = obj8.AddComponent<Toggle>();
     toggle.targetGraphic = image;
     toggle.graphic = image2;
     toggle.isOn = true;
     Image image3 = obj5.AddComponent<Image>();
     image3.sprite = resources.standard;
     image3.type = Image.Type.Sliced;
     ScrollRect rect = obj5.AddComponent<ScrollRect>();
     rect.content = (RectTransform) obj7.transform;
     rect.viewport = (RectTransform) obj6.transform;
     rect.horizontal = false;
     rect.movementType = ScrollRect.MovementType.Clamped;
     rect.verticalScrollbar = component;
     rect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
     rect.verticalScrollbarSpacing = -3f;
     obj6.AddComponent<Mask>().showMaskGraphic = false;
     Image image4 = obj6.AddComponent<Image>();
     image4.sprite = resources.mask;
     image4.type = Image.Type.Sliced;
     Text text2 = obj3.AddComponent<Text>();
     SetDefaultTextValues(text2);
     text2.alignment = TextAnchor.MiddleLeft;
     obj4.AddComponent<Image>().sprite = resources.dropdown;
     Image image6 = parent.AddComponent<Image>();
     image6.sprite = resources.standard;
     image6.color = s_DefaultSelectableColor;
     image6.type = Image.Type.Sliced;
     Dropdown slider = parent.AddComponent<Dropdown>();
     slider.targetGraphic = image6;
     SetDefaultColorTransitionValues(slider);
     slider.template = obj5.GetComponent<RectTransform>();
     slider.captionText = text2;
     slider.itemText = lbl;
     lbl.text = "Option A";
     Dropdown.OptionData item = new Dropdown.OptionData {
         text = "Option A"
     };
     slider.options.Add(item);
     item = new Dropdown.OptionData {
         text = "Option B"
     };
     slider.options.Add(item);
     item = new Dropdown.OptionData {
         text = "Option C"
     };
     slider.options.Add(item);
     slider.RefreshShownValue();
     RectTransform transform2 = obj3.GetComponent<RectTransform>();
     transform2.anchorMin = Vector2.zero;
     transform2.anchorMax = Vector2.one;
     transform2.offsetMin = new Vector2(10f, 6f);
     transform2.offsetMax = new Vector2(-25f, -7f);
     RectTransform transform3 = obj4.GetComponent<RectTransform>();
     transform3.anchorMin = new Vector2(1f, 0.5f);
     transform3.anchorMax = new Vector2(1f, 0.5f);
     transform3.sizeDelta = new Vector2(20f, 20f);
     transform3.anchoredPosition = new Vector2(-15f, 0f);
     RectTransform transform4 = obj5.GetComponent<RectTransform>();
     transform4.anchorMin = new Vector2(0f, 0f);
     transform4.anchorMax = new Vector2(1f, 0f);
     transform4.pivot = new Vector2(0.5f, 1f);
     transform4.anchoredPosition = new Vector2(0f, 2f);
     transform4.sizeDelta = new Vector2(0f, 150f);
     RectTransform transform5 = obj6.GetComponent<RectTransform>();
     transform5.anchorMin = new Vector2(0f, 0f);
     transform5.anchorMax = new Vector2(1f, 1f);
     transform5.sizeDelta = new Vector2(-18f, 0f);
     transform5.pivot = new Vector2(0f, 1f);
     RectTransform transform6 = obj7.GetComponent<RectTransform>();
     transform6.anchorMin = new Vector2(0f, 1f);
     transform6.anchorMax = new Vector2(1f, 1f);
     transform6.pivot = new Vector2(0.5f, 1f);
     transform6.anchoredPosition = new Vector2(0f, 0f);
     transform6.sizeDelta = new Vector2(0f, 28f);
     RectTransform transform7 = obj8.GetComponent<RectTransform>();
     transform7.anchorMin = new Vector2(0f, 0.5f);
     transform7.anchorMax = new Vector2(1f, 0.5f);
     transform7.sizeDelta = new Vector2(0f, 20f);
     RectTransform transform8 = obj9.GetComponent<RectTransform>();
     transform8.anchorMin = Vector2.zero;
     transform8.anchorMax = Vector2.one;
     transform8.sizeDelta = Vector2.zero;
     RectTransform transform9 = obj10.GetComponent<RectTransform>();
     transform9.anchorMin = new Vector2(0f, 0.5f);
     transform9.anchorMax = new Vector2(0f, 0.5f);
     transform9.sizeDelta = new Vector2(20f, 20f);
     transform9.anchoredPosition = new Vector2(10f, 0f);
     RectTransform transform10 = obj11.GetComponent<RectTransform>();
     transform10.anchorMin = Vector2.zero;
     transform10.anchorMax = Vector2.one;
     transform10.offsetMin = new Vector2(20f, 1f);
     transform10.offsetMax = new Vector2(-10f, -2f);
     obj5.SetActive(false);
     return parent;
 }
    void OnLevelWasLoaded()
    {
        _localizationDictionary = new Dictionary<string, Dictionary<string, string>>();

        UpdateDictionary();
        var dropdownObject = new List<Dropdown>(Resources.FindObjectsOfTypeAll<Dropdown>()).Find(i => i.name == "LanguageSelect");
        if (dropdownObject == null) {
            Debug.LogError("Localization::UpdateLocalization >> Make sure the languageSelect dropdown is called \"LanguageSelect\"");
            CurrentLanguage = "English";
        } else {
            dropdownObject.options.Clear();
            foreach (var key in _localizationDictionary.Keys) {
                Dropdown.OptionData data = new Dropdown.OptionData(key);
                dropdownObject.options.Add(data);
            }

            CurrentLanguage = dropdownObject.options[PlayerPrefs.GetInt("Language")].text;
        }
        dropdownObject.value = PlayerPrefs.GetInt("Language");

        UpdateLocalization();
    }
    public void RecuperaElencoCartelle()
    {
        personaggioProvaEsiste = false;
        erroreCaricamento.text = string.Empty;
        Dropdown.OptionData Tmp = null;
        elencoCartelleDropDown.options.Clear();

        for (int i = 0; i < cartelleLocali.Count; i++)
        {
            Tmp = new Dropdown.OptionData();

            Tmp.text = cartelleLocali[i];

            if (cartelleLocali[i] == "PersonaggioDiProva")
            {
                personaggioProvaEsiste = true;
                continue;
            }

            elencoCartelleDropDown.options.Add(Tmp);
        }
        int numeroCartelleMinimo = 0;
        numeroCartelleMinimo = !personaggioProvaEsiste ? 0 : 1;
        if (cartelleLocali.Count > numeroCartelleMinimo)
        {
            personaggiInCarica = true;
            bottoneCaricaDaMainManu.interactable = true;
            bottoneEliminaPartita.interactable = true;
            elencoCartelleDropDown.value = -1;    //visualizzo sempre il primo elemento della lista
            Statici.nomePersonaggio = elencoCartelleDropDown.options[elencoCartelleDropDown.value].text;
        }
        else
        {
            personaggiInCarica = false;
            Statici.nomePersonaggio = string.Empty;
            bottoneCaricaDaMainManu.interactable = false;
            bottoneCaricaDaCaricamento.interactable = false;
            bottoneEliminaPartita.interactable = false;
            erroreCaricamento.text = "Non ci sono partite salvate";
            vitaCaricamento.text = "none";
            attaccoCaricamento.text = "none";
            difesaCaricamento.text = "none";
            if (tmpGOPrecedente != null)
            {
                tmpGOPrecedente.transform.position = dizionarioPosizioniPrecedenti[tmpGOPrecedente.name].position;
                tmpGOPrecedente.transform.rotation = dizionarioPosizioniPrecedenti[tmpGOPrecedente.name].rotation;
            }
            elencoCartelleDropDown.captionText.text = string.Empty;  //NON VISUALIZZA LA STRINGA QUANDO LA LISTA E' VUOTA
        }
    }
示例#51
0
    void Start ()
    {
        stlInterpreter = new StlInterpreter();
        mainMenu = GameObject.Find("Main Menu");
        folderWindow = GameObject.Find("Folder Window");
        sceneWindow = GameObject.Find("Scene Window");

        folderWindow.GetComponent<PanelFades>().FadeOut();
        sceneWindow.GetComponent<PanelFades>().FadeOut();
        _cursor = Instantiate(cursor) as GameObject;
        _cursor.transform.SetParent(mainMenu.transform);
        var pos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y + mouseYoffset, -1f));
        var rot = new Quaternion(0, 0, 0, 0);
        _cursor.transform.localPosition = pos;
        _cursor.transform.localRotation = rot;
        MM = GameObject.Find("MESH").GetComponent<MakeMesh>();
        MM.material = Mat;
        MM.Begin();

        for (int i = 0; i < landscapes.Count; i++)
        {
            var l = Instantiate(landscapes[i]);
            l.name = landscapes[i].name;
            l.active = false;
            landscapes[i] = l;
        }

        for (int i = 0; i < props.Count; i++)
        {
            var p = Instantiate(props[i]);
            p.name = props[i].name;
            p.active = false;
            props[i] = p;
        }

        var options = new List<Dropdown.OptionData>(skyboxes.Count);
        foreach (var skybox in skyboxes)
        {
            var newOption = new Dropdown.OptionData(skybox.name);
            options.Add(newOption);
        }
        skyboxDD.options = options;

        options = new List<Dropdown.OptionData>(MM.materials.Count);
        foreach (var mat in MM.materials)
        {
            var newOption = new Dropdown.OptionData(mat.name);
            options.Add(newOption);
        }
        materialDD.options = options;

        options = new List<Dropdown.OptionData>(landscapes.Count);
        var none = new Dropdown.OptionData("None");
        options.Add(none);
        foreach (var landscape in landscapes)
        {
            var newOption = new Dropdown.OptionData(landscape.name);
            options.Add(newOption);
        }
        landscapeDD.options = options;

        options = new List<Dropdown.OptionData>(props.Count);
        options.Add(none);
        foreach (var prop in props)
        {
            var newOption = new Dropdown.OptionData(prop.name);
            options.Add(newOption);
        }
        propDD.options = options;
        currentProp = null;



        materialDD.onValueChanged.AddListener(delegate {
            MaterialDropdownValueChangedHandler(materialDD);
        });

        skyboxDD.onValueChanged.AddListener(delegate {
            SkyboxDropdownValueChangedHandler(skyboxDD);
        });

        landscapeDD.onValueChanged.AddListener(delegate {
            LandscapeDropdownValueChangedHandler(landscapeDD);
        });

        propDD.onValueChanged.AddListener(delegate {
            PropDropdownValueChangedHandler(propDD);
        });
    }
示例#52
0
	// Use this for initialization
	void Start () 
    {
        var objManaSlider = GameObject.Find("Mana Slider");
        manaSlider = objManaSlider.GetComponent<Slider>();
        var objStaminaSlider = GameObject.Find("Stamina Slider");
        staminaSlider = objStaminaSlider.GetComponent<Slider>();

        var objTxtMana = GameObject.Find("txtMana");
        txtMana = objTxtMana.GetComponent<Text>();
        var objTxtStamina = GameObject.Find("txtStamina");
        txtStamina = objTxtStamina.GetComponent<Text>();

        AttackType = "Power";

        attackType = cmbAttackType.GetComponent<Dropdown>();

        attackType.onValueChanged.AddListener(delegate
        {
            OnCmbAttackTypeChanged(attackType);
        });

        attacks = cmbAttacks.GetComponent<Dropdown>();
        attackCanvas = cmbAttacks.GetComponent<CanvasGroup>();
        var attackData = csGameController.control.Kagotchi.Attacks;
        foreach(var item in attackData)
        {
            Dropdown.OptionData cmbItem = new Dropdown.OptionData(item.Name);
            attacks.options.Add(cmbItem);
        }

        attacks.onValueChanged.AddListener(delegate
        {
            OnCmbAttacksChanged(attacks);
        });

        powers = cmbPowers.GetComponent<Dropdown>();
        powerCanvas = cmbPowers.GetComponent<CanvasGroup>();
        var powersData = csGameController.control.Kagotchi.Powers;
        foreach (var item in powersData)
        {
            Dropdown.OptionData cmbItem = new Dropdown.OptionData(item.Name);
            powers.options.Add(cmbItem);
        }

        powers.onValueChanged.AddListener(delegate
        {
            OnCmbPowersChanged(powers);
        });

        physicalDefense = cmbPhysicalDefense.GetComponent<Dropdown>();
        var physicalDefenseData = csGameController.control.Kagotchi.PhysicalDefense;
        foreach (var item in physicalDefenseData)
        {
            Dropdown.OptionData cmbItem = new Dropdown.OptionData(item.Name);
            physicalDefense.options.Add(cmbItem);
        }

        physicalDefense.onValueChanged.AddListener(delegate
        {
            OnCmbPhysicalDefenseChanged(physicalDefense);
        });

        magicalDefense = cmbMagicalDefense.GetComponent<Dropdown>();
        var magicalDefenseData = csGameController.control.Kagotchi.MagicalDefense;
        foreach (var item in magicalDefenseData)
        {
            Dropdown.OptionData cmbItem = new Dropdown.OptionData(item.Name);
            magicalDefense.options.Add(cmbItem);
        }

        magicalDefense.onValueChanged.AddListener(delegate
        {
            OnCmbMagicalDefenseChanged(magicalDefense);
        });

        /*var items = cmbItems.GetComponent<Dropdown>();
        var itemsData = csGameController.control.Items;
        foreach (var item in itemsData)
        {
            Dropdown.OptionData cmbItem = new Dropdown.OptionData(item.Name);
            items.options.Add(cmbItem);
        }*/

        attackCanvas.alpha = 0;
        attackCanvas.blocksRaycasts = false;
        attackCanvas.interactable = false;

        powerCanvas.alpha = 1;
        powerCanvas.blocksRaycasts = true;
        powerCanvas.interactable = true;
  
	}
	public void ReadAllFolders(){
		EnvType.ClearOptions ();

		LoadedEnvPaths = new List<string> ();
		List<Dropdown.OptionData> NewOptions = new List<Dropdown.OptionData> ();

		if(!Directory.Exists(EnvPaths.GetGamedataPath())){
			Debug.LogError("Gamedata path not exist!");
			return;
		}

		FileStream fs = File.OpenRead(EnvPaths.GetGamedataPath() + "env.scd");
		ZipFile zf = new ZipFile(fs);

		foreach (ZipEntry zipEntry in zf) {
			if (!zipEntry.IsDirectory) {
				continue;
			}

			string LocalName = zipEntry.Name.Replace("env/", "");

			if (LocalName.Length == 0)
				continue;

			int ContSeparators = 0;
			char Separator = ("/")[0];
			for (int i = 0; i < LocalName.Length; i++) {
				if (LocalName [i] == Separator) {
					ContSeparators++;
					if (ContSeparators > 1)
						break;
				}
			}
			if (ContSeparators > 1)
				continue;

			LocalName = LocalName.Replace ("/", "");

			LoadedEnvPaths.Add (LocalName);
			Dropdown.OptionData NewOptionInstance = new Dropdown.OptionData (LocalName);
			NewOptions.Add (NewOptionInstance);
		}

		LoadedEnvPaths.Add ("maps/");
		Dropdown.OptionData NewOptionInstance2 = new Dropdown.OptionData ("Map folder" );
		NewOptions.Add (NewOptionInstance2);

		EnvType.AddOptions (NewOptions);

	}
示例#54
0
    /// <summary>
    /// fills the PlayerSelection dropdown with the player names. Only players will be added, whose playerdata directory is valid.
    /// </summary>
    private void UpdateDropdown()
    {
        Dropdown dropdown = GameObject.Find(DropdownGameObject).GetComponent<Dropdown>();
        Dropdown.OptionData element;

        // add unpersonalized player first
        element = new Dropdown.OptionData(UnpersonalizedPlayerName);
        dropdown.options.Add(element);

        // add personalized players after unpersonlized one
        foreach (string playerName in FileCtrl.GetPlayerList())
        {
            element = new Dropdown.OptionData(playerName);
            dropdown.options.Add(element);
        }

        dropdown.value = playerIndex;
        ChangePlayer(dropdown.value);
        GameObject.Find(DropdownGameObject + "/Label").GetComponent<UnityEngine.UI.Text>().text = GetSelectedPlayerName();
    }
示例#55
0
        public void updateBattleActionOptions(BattleCharacter battleCharacter)
        {
            this.focusedBattleCharacter = battleCharacter;

            if (focusedBattleCharacter.role == BattleConstants.CHARACTER_ROLE_BLUE) {
                BattleAction battleAction = new BattleAction();
                battleAction.sources.Add(focusedBattleCharacter);
                battleAction.skill = focusedBattleCharacter.getSkills()[0];

                int targetCharacterIndex = 0;
                for (int i = 0; i < battleCharacters.Count; i++) {
                    if (battleCharacters[i].role == BattleConstants.CHARACTER_ROLE_RED) {
                        targetCharacterIndex = i;
                        break;
                    }
                }
                battleAction.targets.Add(battleCharacters[targetCharacterIndex]);

                this.battle.continueBattle(battleAction);
                return;
            }

            List<BattleSkill> skills = this.focusedBattleCharacter.getSkills();
            skills.Sort();
            battleCharacters.Sort();

            redsDropdown.options.Clear();
            Dropdown.OptionData redCharactersOptionData = new Dropdown.OptionData();
            redCharactersOptionData.text = battleCharacter.name;
            redsDropdown.options.Add(redCharactersOptionData);

            skillsDropdown.options.Clear();
            for (int i = 0; i < skills.Count; i++) {
                Dropdown.OptionData skillOptionData = new Dropdown.OptionData();
                skillOptionData.text = skills[i].name;
                skillsDropdown.options.Add(skillOptionData);
            }

            bluesDropdown.options.Clear();
            for (int i = 0; i < battleCharacters.Count; i++) {
                if (battleCharacters[i].role == BattleConstants.CHARACTER_ROLE_BLUE) {
                    Dropdown.OptionData blueOptionData = new Dropdown.OptionData();
                    blueOptionData.text = battleCharacters[i].name;
                    bluesDropdown.options.Add(blueOptionData);
                }
            }
        }
    /// <remarks>
    /// This class should create some dummy decks for the user to select and load them into the player data object,
    /// and manage all of the button functions for the menu. 
    /// </remarks>
    void Start()
    {
        Player1Data.GetComponent<player>().Name = "Player 1";
        Player2Data.GetComponent<player>().Name = "Player 2";

        exitMenu.enabled = false;
        helperPrompt.enabled = false;

        DontDestroyOnLoad(Player1Data);
        DontDestroyOnLoad(Player2Data);

        /*
        List<TextAsset> decks = new List<TextAsset>();

        TextAsset[] stuff = (TextAsset[])Resources.LoadAll("Decks");

        foreach (TextAsset xmlDeck in stuff)
        {

            DeckReader reader = new DeckReader();

            List<Card> database = reader.load(xmlDeck);

            Deck deck = new Deck(reader.GetDeckName(xml));

            foreach (Card c in database)
            {
                deck.archiveDeck.Add(c);
            }

            deckPool.Add(deck);
        }
        */

        //paths.Add("/scripts/xml/cards.xml");
        //paths.Add("/scripts/xml/2cards.xml");
        //paths.Add("/scripts/xml/3cards.xml");
        //paths.Add("/scripts/xml/neutralsAndSpells.xml");
        // The newest spells that you can buy!

        paths.Add("/scripts/xml/spellsWithModifiers.xml");
        paths.Add("/scripts/xml/spellsWithModifiers.xml");
        paths.Add("/scripts/xml/spellsWithModifiers.xml");
        paths.Add("/scripts/xml/spellsWithModifiers.xml");
        paths.Add("/scripts/xml/spellsWithModifiers.xml");

        foreach (string p in paths)
        {

            //TEMP: method to create deck pool from all usable decks, for now, creates same deck off archive
            string path = Application.dataPath + p;

            DeckReader reader = new DeckReader();

            List<Card> database = reader.load(path);

            Deck deck = new Deck(path, reader.GetDeckName(path));

            foreach (Card c in database)
            {
                deck.archiveDeck.Add(c);
            }

            deckPool.Add(deck);
            i++;
        }

        foreach (Deck d in deckPool)
        {
            Dropdown.OptionData data = new Dropdown.OptionData(d.deckName);
            p1Selector.options.Add(data);
            p2Selector.options.Add(data);
            //Debug.Log("Option added of deckName " + d.deckName);
        }

        Player1Data.GetComponent<player>().DeckPath = deckPool[0].path;
        Player2Data.GetComponent<player>().DeckPath = deckPool[0].path;
    }
示例#57
0
    private void PopulatePetNames()
    {
        ChoosePetDropDown.options.Clear();

        //Dropdown.OptionData addAPetMessage = new Dropdown.OptionData("Add Pet...");
        //ChoosePetDropDown.options.Add(addAPetMessage);

        mPets = MurpleEntry.MurpleControl.GetAllPodsOfType(PodTypeName);

        foreach (Murple.Pod thisPet in mPets)
        {
            Dropdown.OptionData petName = new Dropdown.OptionData(thisPet.Name);
            ChoosePetDropDown.options.Add(petName);
        }

        ChoosePetDropDown.value = 0;
    }
示例#58
0
    // Use this for initialization
    void Start()
    {
        ui = Instantiate(Resources.Load("tests/UI/CustomControllerTestUI")) as GameObject;

        PlayerCustomController playerCustomController = this.GetComponent<PlayerCustomController>();

        List<SkinnedMeshRenderer> skinnedMeshRenderers = new List<SkinnedMeshRenderer>();

        skinnedMeshRenderers.AddRange(playerCustomController.heads.Values.ToArray());
        skinnedMeshRenderers.AddRange(playerCustomController.bodys.Values.ToArray());
        skinnedMeshRenderers.AddRange(playerCustomController.capes.Values.ToArray());
        skinnedMeshRenderers.AddRange(playerCustomController.clavicles.Values.ToArray());
        skinnedMeshRenderers.AddRange(playerCustomController.foots.Values.ToArray());
        skinnedMeshRenderers.AddRange(playerCustomController.hands.Values.ToArray());
        skinnedMeshRenderers.AddRange(playerCustomController.skirts.Values.ToArray());

        foreach (string name in TypeZB)
        {
            Dropdown dropdown = ui.transform.Find("Panel/Image/" + name).GetComponent<Dropdown>();

            dropdown.captionText.text = name;
            dropdown.options.Clear();

            string defaultZB = "";
            foreach (SkinnedMeshRenderer o in skinnedMeshRenderers)
            {
                if (o.name.StartsWith(name + "_"))
                {
                    Dropdown.OptionData optionData = new Dropdown.OptionData();
                    optionData.text = o.name;
                    dropdown.options.Add(optionData);

                    defaultZB = o.name;
                }
            }

            if (!string.IsNullOrEmpty(defaultZB))
            {
                ChangeZB(defaultZB, name);
            }

            if (name.Equals("Head"))
            {
                dropdown.onValueChanged.AddListener(changeHead);
            }
            else if (name.Equals("Body"))
            {
                dropdown.onValueChanged.AddListener(changeBody);
            }
            else if (name.Equals("Foot"))
            {
                dropdown.onValueChanged.AddListener(changeFoot);
            }
            else if (name.Equals("Hand"))
            {
                dropdown.onValueChanged.AddListener(changeHand);
            }
            else if (name.Equals("Clavicle"))
            {
                dropdown.onValueChanged.AddListener(changeClavicle);
            }
            else if (name.Equals("Skirt"))
            {
                dropdown.onValueChanged.AddListener(changeSkirt);
            }
            else if (name.Equals("Cape"))
            {
                dropdown.onValueChanged.AddListener(changeCape);
            }
        }
    }
    public void Start()
    {
        this.pointList = new List<Punto>();
        this.squareList = new List<FiguraGeometrica>();
        this.circleList = new List<FiguraGeometrica>();
        dropdownPointsSquare.GetComponent<Dropdown>().ClearOptions();
        dropdownPointsCircle.GetComponent<Dropdown>().ClearOptions();
        dropdownSquare.GetComponent<Dropdown>().ClearOptions();
        dropdownCircle.GetComponent<Dropdown>().ClearOptions();
        dropdownSquareColor.GetComponent<Dropdown>().ClearOptions();
        dropdownCircleColor.GetComponent<Dropdown>().ClearOptions();
        string[] colors = { "Rojo", "Verde", "Azul", "Blanco", "Negro" };

        Dropdown.OptionData dropdownPointList = new Dropdown.OptionData();
        foreach (string color in colors) {
            dropdownPointList = new Dropdown.OptionData(color);
            dropdownSquareColor.GetComponent<Dropdown>().options.Add(dropdownPointList);
            dropdownSquareColor.GetComponent<Dropdown>().RefreshShownValue();
            dropdownCircleColor.GetComponent<Dropdown>().options.Add(dropdownPointList);
            dropdownCircleColor.GetComponent<Dropdown>().RefreshShownValue();
        }
        Analytics.SetUserGender(Gender.Unknown);
        Analytics.SetUserBirthYear(1987);
    }
 // Use this for initialization
 void Start()
 {
     Dropdown.OptionData dado = new Dropdown.OptionData("");
     dropDownSelecionarJogador.options = gerarListaUsuarios();
 }