Beispiel #1
0
        private static void LoadAbilityGroupConfig(DataFormat dataFormat)
        {
            AbilityGroupConfigDict.Clear();
            DirectoryInfo di = new DirectoryInfo(AbilityGroupConfigFolder_Build);

            if (di.Exists)
            {
                foreach (FileInfo fi in di.GetFiles("*.config", SearchOption.AllDirectories))
                {
                    byte[]       bytes  = File.ReadAllBytes(fi.FullName);
                    AbilityGroup config = SerializationUtility.DeserializeValue <AbilityGroup>(bytes, dataFormat);
                    if (AbilityConfigDict.ContainsKey(config.AbilityGroupName))
                    {
                        Debug.LogError($"技能组重名:{config.AbilityGroupName}");
                    }
                    else
                    {
                        foreach (string ac_name in config.AbilityNames)
                        {
                            if (AbilityConfigDict.TryGetValue(ac_name, out Ability ability))
                            {
                                config.Abilities.Add(ability);
                            }
                        }

                        AbilityGroupConfigDict.Add(config.AbilityGroupName, config);
                    }
                }
            }
            else
            {
                Debug.LogError("技能组配置表不存在");
            }
        }
        public void FocusOn(AbilityGroup group)
        {
            focusedSet = group;
            if (focusedSet == null)
            {
                return;
            }

            ItemList.ItemsSource = focusedSet.Abilities;
        }
Beispiel #3
0
        public Spellbook(Combatant combatant, List <Models.AbilityGroup> abilitiesByGroup)
        {
            this.abilitiesByGroup = new List <AbilityGroup>();

            foreach (Models.AbilityGroup abilityGroupModel in abilitiesByGroup)
            {
                List <Ability> abilitiesInGroup = new List <Ability>();

                foreach (Models.Ability abilityModel in abilityGroupModel.Abilities)
                {
                    Ability ability = CreateAbility(abilityModel);
                    ability.ActingCombatant = combatant;
                    abilitiesInGroup.Add(ability);
                }

                AbilityGroup abilityGroup = new AbilityGroup(abilitiesInGroup);

                this.abilitiesByGroup.Add(abilityGroup);
            }
        }
Beispiel #4
0
        private static void ExportAbilityGroupConfig(DataFormat dataFormat)
        {
            string folder = AbilityGroupConfigFolder_Build;

            if (Directory.Exists(folder))
            {
                Directory.Delete(folder, true);
            }
            Directory.CreateDirectory(folder);

            DirectoryInfo di = new DirectoryInfo(Application.dataPath + DesignRoot + AbilityGroupConfigFolder_Relative);

            foreach (FileInfo fi in di.GetFiles("*.asset"))
            {
                string relativePath             = CommonUtils.ConvertAbsolutePathToProjectPath(fi.FullName);
                Object configObj                = AssetDatabase.LoadAssetAtPath <Object>(relativePath);
                AbilityGroupConfigSSO configSSO = (AbilityGroupConfigSSO)configObj;
                AbilityGroup          config    = configSSO.GetAbilityGroup_NoData();
                string path  = folder + configSSO.name + ".config";
                byte[] bytes = SerializationUtility.SerializeValue(config, dataFormat);
                File.WriteAllBytes(path, bytes);
            }
        }
Beispiel #5
0
 public void FocusOn(AbilityGroup set)
 {
     GroupViewer.FocusOn(set);
     AbilityViewer.FocusOn(null);
 }
Beispiel #6
0
 public void Set(AbilityGroup ag, int indexInGroup)
 {
     group = ag;
     index = indexInGroup;
 }
Beispiel #7
0
 public AbilityGroupIndex(AbilityGroup ag, int indexInGroup)
 {
     group = ag;
     index = indexInGroup;
 }
Beispiel #8
0
 public AbilityGroupIndex()
 {
     group = AbilityGroup.NONE;
     index = -1;
 }