Beispiel #1
0
 public void OnGUI()
 {
     if (equipmentVisualConfig == null)
     {
         string equipmentVisualConfigContent =
             ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/EquipmentVisualConfig.txt")).text;
         equipmentVisualConfig = JsonMapper.ToObject <EquipmentVisualConfig>(equipmentVisualConfigContent);
         foreach (int groupId in poolOfCharacterGroupId)
         {
             poolOfWeaponVisualIdByCharacterGroupId[groupId] = new List <int>();
             poolOfWeaponNameByCharacterGroupId[groupId]     = new List <string>();
             IEnumerable <KeyValuePair <string, EquipmentVisualAvailableInfo> > allEquipmentVisualAvailableInfos = equipmentVisualConfig.GetAllEquipmentVisualAvailableInfos(EquipmentType.Weapon);
             List <KeyValuePair <string, EquipmentVisualAvailableInfo> >        sorted = new List <KeyValuePair <string, EquipmentVisualAvailableInfo> >(allEquipmentVisualAvailableInfos);
             sorted.Sort((pair1, pair2) => { return(pair1.Value.VisualId.CompareTo(pair2.Value.VisualId)); });
             foreach (KeyValuePair <string, EquipmentVisualAvailableInfo> pair in sorted)
             {
                 poolOfWeaponVisualIdByCharacterGroupId[groupId].Add(pair.Value.VisualId);
                 poolOfWeaponNameByCharacterGroupId[groupId].Add(pair.Value.GetLocalizeName(new CharacterId(groupId, 1)));
             }
         }
     }
     EditorGUI.BeginChangeCheck();
     DrawMaterialNames();
     DrawWeaponMaterials();
     if (EditorGUI.EndChangeCheck())
     {
         EditorUtility.SetDirty(this);
     }
 }
        public void OnGUI()
        {
            if (monsterConfig == null)
            {
                string monsterConfigContent =
                    ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/MonsterConfig.txt")).text;
                monsterConfig = JsonMapper.ToObject <MonsterConfig>(monsterConfigContent);
                List <int> listAllGroupIds = monsterConfig.ListAllGroupIds();
                listAllGroupIds.Sort((i, i1) => { return(i - i1); });
                poolOfCharacterGroupId = new List <int>(listAllGroupIds);
            }

            if (equipmentVisualConfig == null)
            {
                poolOfWeaponVisualId = new List <int>();
                poolOfWeaponName     = new List <string>();
                CharacterId characterId = new CharacterId(1, 1);
                string      equipmentVisualConfigContent =
                    ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/EquipmentVisualConfig.txt"))
                    .text;
                equipmentVisualConfig = JsonMapper.ToObject <EquipmentVisualConfig>(equipmentVisualConfigContent);
                IEnumerable <KeyValuePair <string, EquipmentVisualAvailableInfo> > allEquipmentVisualAvailableInfos =
                    equipmentVisualConfig.GetAllEquipmentVisualAvailableInfos(EquipmentType.Weapon);
                List <KeyValuePair <string, EquipmentVisualAvailableInfo> > sorted = new List <KeyValuePair <string, EquipmentVisualAvailableInfo> >(allEquipmentVisualAvailableInfos);
                sorted.Sort((pair1, pair2) => { return(pair1.Value.VisualId.CompareTo(pair2.Value.VisualId)); });
                HashSet <int> uniqueVisualIds = new HashSet <int>();
                foreach (KeyValuePair <string, EquipmentVisualAvailableInfo> pair in sorted)
                {
                    if (!uniqueVisualIds.Contains(pair.Value.VisualId))
                    {
                        uniqueVisualIds.Add(pair.Value.VisualId);
                        poolOfWeaponVisualId.Add(pair.Value.VisualId);
                        poolOfWeaponName.Add(pair.Value.GetLocalizeName(characterId));
                    }
                }
            }

            if (foldout == null)
            {
                Foldout f = LoadFoldout(this);
                if (f == null)
                {
                    f = new Foldout();
                }

                foldout = f;
            }

            EditorGUI.BeginChangeCheck();
            DrawProxyNames();
            DrawProxyEntries(foldout);
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(this);
                SaveFoldout(this, foldout);
            }
        }