예제 #1
0
 public ValueDropdownList<int> GetAllTypeIndex()
 {
     ValueDropdownList<int> res = new ValueDropdownList<int>();
     for (int i = 0; i < typeName.Count; i++)
         res.Add(new ValueDropdownItem<int>(typeName[i], i));
     return res;
 }
예제 #2
0
        private static IEnumerable langFlag()
        {
            var list = new ValueDropdownList <LangFlag>();

            Rosetta.LangNames.ForEach(pair => list.Add(new ValueDropdownItem <LangFlag>($"{pair.Value} ({pair.Key.ToString()})", pair.Key)));
            return(list);
        }
예제 #3
0
    public ValueDropdownList <CLASS_STATE> GetStateList()
    {
        if (_listState_Fixed == null)
        {
            _listState_Fixed = new List <CLASS_STATE>();
        }
        _listState_Fixed.Clear();
        OnSetStateList_IfCountZero_IsError(ref _listState_Fixed);

        if (_list_ForPrint == null)
        {
            _list_ForPrint = new ValueDropdownList <CLASS_STATE>();
        }
        _list_ForPrint.Clear();
        for (int i = 0; i < _listState_Fixed.Count; i++)
        {
            _list_ForPrint.Add(_listState_Fixed[i].IDictionaryItem_GetKey().ToString(), _listState_Fixed[i]);
        }

        if (_list_ForPrint.Count == 0)
        {
            Debug.LogError("_list_ForPrint.Count == 0");
        }

        return(_list_ForPrint);
    }
예제 #4
0
        public ValueDropdownList <System.Type> GetFilteredTypeList()
        {
            var list = new ValueDropdownList <System.Type>();

            var types = typeof(Objects.UseableObject).Assembly.GetTypes();

            foreach (var type in types)
            {
                if (type.IsAbstract)
                {
                    continue;
                }
                if (type.IsGenericTypeDefinition)
                {
                    continue;
                }
                if (type.ContainsGenericParameters)
                {
                    continue;
                }
                if (!typeof(MonoBehaviour).IsAssignableFrom(type))
                {
                    continue;
                }
                list.Add(type.Name, type);
            }

            return(list);
        }
예제 #5
0
    public ValueDropdownList <System.Type> GetCommandList()
    {
        ValueDropdownList <System.Type> listCommand = new ValueDropdownList <System.Type>();

        System.Type[] arrInnerClassType = _pGetInheritedClassType.GetNestedTypes(BindingFlags.Public);
        for (int i = 0; i < arrInnerClassType.Length; i++)
        {
            System.Type pCurrentType = arrInnerClassType[i];
            if (pCurrentType.IsAbstract == false)
            {
                if (_mapCommandInstance.ContainsKey(pCurrentType) == false || _mapCommandInstance[pCurrentType] == null)
                {
                    object pObjectCommandInstance = System.Activator.CreateInstance(pCurrentType);
                    if (pObjectCommandInstance != null && (pObjectCommandInstance is CommandBase) == false)
                    {
                        Debug.LogError(pCurrentType.Name + " is not inherit CommandBase");
                        continue;
                    }

                    _mapCommandInstance[pCurrentType] = pObjectCommandInstance as CommandBase;
                }

                listCommand.Add(_mapCommandInstance[pCurrentType].GetDisplayCommandName(), pCurrentType);
            }
        }

        return(listCommand);
    }
예제 #6
0
 public void InitializeValues(PathingAutoMovement target)
 {
     if (!isInitialized)
     {
         isInitialized   = true;
         pathingNodeList = target.PathingNodeList;
     }
 }
예제 #7
0
    public IList <ValueDropdownItem <int> > GetAllTypeName()
    {
        var res = new ValueDropdownList <int>();

        for (int i = 0; i < GameDatabase.Count; i++)
        {
            res.Add(GameDatabase[i], i);
        }
        return(res);
    }
예제 #8
0
        /// Used in <see cref="CurrentObject"/>'s drawer settings.
        ValueDropdownList <GameObject> GetPrefabValues()
        {
            var list = new ValueDropdownList <GameObject>();

            foreach (var prefabSettings in ObjectSettings)
            {
                list.Add(prefabSettings.Prefab.name, prefabSettings.Prefab);
            }
            return(list);
        }
예제 #9
0
    // for In-Editor use
    ValueDropdownList <string> GetValues()
    {
        var list = new ValueDropdownList <string>();

        foreach (var pair in AnimatorStatesHelper.instance.References)
        {
            list.Add(pair.Value.name, pair.Key);
        }
        return(list);
    }
예제 #10
0
    static public string[] GetNameList <T>(this ValueDropdownList <T> list)
    {
        string[] arrName = new string[list.Count];
        for (int i = 0; i < list.Count; i++)
        {
            arrName[i] = list[i].Text;
        }

        return(arrName);
    }
예제 #11
0
        private void SetWindowTemplate()
        {
            Dictionary <string, string> windowTemplates    = GeneralWindowHelper.GetWindowTemplates();
            ValueDropdownList <string>  csHtmlTemplatesTmp = csHtmlTemplates as ValueDropdownList <string>;

            foreach (var item in windowTemplates)
            {
                csHtmlTemplatesTmp.Add(item.Key, item.Value);
            }
        }
예제 #12
0
            public MyTogItem()
            {
                Dictionary <string, string> itemTemplates      = GeneralWindowHelper.GetItemTemplates();
                ValueDropdownList <string>  csHtmlTemplatesTmp = csHtmlTemplates as ValueDropdownList <string>;

                foreach (var item in itemTemplates)
                {
                    csHtmlTemplatesTmp.Add(item.Key, item.Value);
                }
            }
예제 #13
0
        private ValueDropdownList <Type> GetTypes()
        {
            var q = typeof(PropertyComponent).Assembly.GetTypes()
                    .Where(x => !x.IsAbstract)
                    .Where(x => !x.IsGenericTypeDefinition)
                    .Where(x => typeof(PropertyComponent).IsAssignableFrom(x));
            var valueDD = new ValueDropdownList <Type>();

            q.ForEach(_ => valueDD.Add(_.Name, _));
            return(valueDD);
        }
예제 #14
0
        public ValueDropdownList <string> SignalsList()
        {
            var signals = new ValueDropdownList <string>();

            signals.Add("");
            for (int i = 0; i < _poses.Count; i++)
            {
                signals.Add(_poses[i].Label);
            }
            return(signals);
        }
예제 #15
0
        public ValueDropdownList <int> GetDays()
        {
            var dropdown  = new ValueDropdownList <int>();
            var monthDays = DaysInMonth[(int)Month - 1];

            for (var i = 0; i < monthDays; i++)
            {
                dropdown.Add(i + 1);
            }
            return(dropdown);
        }
예제 #16
0
        public static ValueDropdownList <int> DropDownFromIDDictionary <T>(Dictionary <int, T> dictionary,
                                                                           Func <T, string> valueToString)
        {
            ValueDropdownList <int> dropDown = new ValueDropdownList <int>();

            foreach (var pair in dictionary)
            {
                dropDown.Add(valueToString(pair.Value), pair.Key);
            }

            return(dropDown);
        }
예제 #17
0
    static public T GetValue_ByText <T>(this ValueDropdownList <T> list, string pItem)
    {
        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].Text.Equals(pItem))
            {
                return(list[i].Value);
            }
        }

        return(default(T));
    }
예제 #18
0
        public static T GetValueFromString <T>(this ValueDropdownList <T> list, string name)
        {
            foreach (var item in list)
            {
                if (item.Text == name)
                {
                    return(item.Value);
                }
            }

            return(default(T));
        }
예제 #19
0
    static public ValueDropdownList <T> ConvertTypeList_To_ValueDownList <T>(ValueDropdownList <T> list, IEnumerable <System.Type> pFilteredTypeList) where T : class, IHasName
    {
        foreach (var pType in pFilteredTypeList)
        {
            T pCurrentT = System.Activator.CreateInstance(pType) as T;
            if (pCurrentT != null)
            {
                list.Add(pCurrentT.IHasName_GetName(), pCurrentT);
            }
        }

        return(list);
    }
예제 #20
0
                private ValueDropdownList <string> GetScenesList()
                {
                    ValueDropdownList <string> scenes = new ValueDropdownList <string>();

                    for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++)
                    {
                        string scene_path = SceneUtility.GetScenePathByBuildIndex(i);

                        scenes.Add(Path.GetFileNameWithoutExtension(scene_path));
                    }

                    return(scenes);
                }
예제 #21
0
        /// <summary>
        /// Clamps target & current nodes between count.
        /// Remakes the dropdown list.
        /// </summary>
        public void RemakeNodeDropdownCount()
        {
            if (PathingNodeList == null)
            {
                pathingNodeList = new ValueDropdownList <int>();
            }
            PathingNodeList.Clear();

            for (int i = 0; i < pathingNodes.Count; i++)
            {
                PathingNodeList.Add("Node " + i, i);
            }
        }
예제 #22
0
 private ValueDropdownList <int> EquipList()
 {
     if (_equipList == null)
     {
         _equipList = new ValueDropdownList <int>();
         _equipList.Add("Passive", 0);
         _equipList.Add("Active", 1);
         _equipList.Add("Turret", 2);
         _equipList.Add("Forward", 3);
         _equipList.Add("Engine", 4);
         _equipList.Add("PowerPlant", 5);
     }
     return(_equipList);
 }
예제 #23
0
        //protected IEnumerable TreeView()
        //{
        //    var q = typeof(UnitActionBase).Assembly.GetTypes()
        //        .Where(x => !x.IsAbstract)
        //        .Where(x => !x.IsGenericTypeDefinition)
        //        .Where(x => typeof(UnitActionBase).IsAssignableFrom(x));
        //    return q;
        //}

        public static IEnumerable TreeView()
        {
            ValueDropdownList <AbilityActionBase> result = new ValueDropdownList <AbilityActionBase>();
            var q = typeof(AbilityActionBase).Assembly.GetTypes()
                    .Where(x => !x.IsAbstract)
                    .Where(x => !x.IsGenericTypeDefinition)
                    .Where(x => typeof(AbilityActionBase).IsAssignableFrom(x));

            foreach (var e in q)
            {
                AbilityActionBase instance = (AbilityActionBase)Activator.CreateInstance(e);
                result.Add(instance.DisplayOnEditor() + "/" + e.Name, (AbilityActionBase)Activator.CreateInstance(e));
            }
            return(result);
        }
예제 #24
0
        public static ValueDropdownList <string> ShaderPropertyNames(Material mat)
        {
            ValueDropdownList <string> dd = new ValueDropdownList <string>();

            dd.Add("None", "None");

            int count = ShaderUtil.GetPropertyCount(mat.shader);

            for (int i = 0; i < count; i++)
            {
                string name = ShaderUtil.GetPropertyName(mat.shader, i);
                dd.Add(name, name);
            }

            return(dd);
        }
예제 #25
0
        protected override void Initialize()
        {
            types = AppDomain.CurrentDomain.GetAssemblies()
                    .Where(x => x.GetTypes().Any())
                    .OrderBy(x => x.GetName().FullName)
                    .SelectMany(x => x.GetTypes().OrderBy(y => y.FullName).Where(y => !y.IsSpecialName && !y.FullName.Contains("<")))
                    .ToList();

            typesList = new ValueDropdownList <Type>();

            for (int i = 0; i < types.Count; i++)
            {
                Type type = types[i];
                typesList.Add(new ValueDropdownItem <Type>(type.FullName.Replace('.', '/'), type));
            }
        }
예제 #26
0
    private ValueDropdownList <SpawnSettingInfo> GetSpawnObjectName_SpawnSettingInfo()
    {
        ValueDropdownList <SpawnSettingInfo> listReturn = new ValueDropdownList <SpawnSettingInfo>();
        var listPrefab = Get_ExistFileNameList_UnityObject <GameObject>(GetDataPath());

        if (listPrefab == null)
        {
            return(null);
        }

        for (int i = 0; i < listPrefab.Count; i++)
        {
            listReturn.Add(listPrefab[i].Text, new SpawnSettingInfo(listPrefab[i].Value));
        }

        return(listReturn);
    }
예제 #27
0
    static public int Calculate_SelectIndex <T>(this ValueDropdownList <T> list, T pItem)
    {
        for (int i = 0; i < list.Count; i++)
        {
            if (Object.ReferenceEquals(list[i].Value, null))
            {
                continue;
            }

            if (list[i].Value.Equals(pItem))
            {
                return(i);
            }
        }

        return(0);
    }
예제 #28
0
    static public ValueDropdownList <T> GetValueDropDownList_EnumSubString <T>()
    {
        ValueDropdownList <T> list = new ValueDropdownList <T>();

        string[] arrStateName = System.Enum.GetNames(typeof(T));
        for (int i = 0; i < arrStateName.Length; i++)
        {
            T           eProjectileName = arrStateName[i].ConvertEnum <T>();
            System.Enum pEnum           = eProjectileName as System.Enum;
            if (pEnum != null)
            {
                list.Add(pEnum.ToStringSub(), eProjectileName);
            }
        }

        return(list);
    }
예제 #29
0
                public ValueDropdownList <string> GetAnimationParams()
                {
                    UnityEditor.Animations.AnimatorController character_anim_controller = Resources.Load <UnityEditor.Animations.AnimatorController>("Animation/LegsAnimationController");

                    ValueDropdownList <string> list = new ValueDropdownList <string>();

                    if (character_anim_controller == null)
                    {
                        return(list);
                    }

                    character_anim_controller.parameters
                    .Select(param => param.name)
                    .ForEach(name => { list.Add(name, name); });

                    return(list);
                }
예제 #30
0
    static public ValueDropdownList <T> Create_Enum_ValueDropdownList <T>()
    {
        ValueDropdownList <T> pListReturn = new ValueDropdownList <T>();

        System.Type pEnumType = typeof(T);

        if (pEnumType.IsEnum)
        {
            string[] arrEnums = pEnumType.GetEnumNames();
            for (int i = 0; i < arrEnums.Length; i++)
            {
                string strCurrentEnumName = arrEnums[i];
                pListReturn.Add(strCurrentEnumName, (T)System.Enum.Parse(typeof(T), strCurrentEnumName));
            }
        }

        return(pListReturn);
    }