Beispiel #1
0
 public void PreloadSceneStories()
 {
     TableConfig.Level cfg = TableConfig.LevelProvider.Instance.GetLevel(m_SceneId);
     if (null != cfg)
     {
         string[] filePath;
         int      ct1 = cfg.SceneDslFile.Count;
         int      ct2 = cfg.ClientDslFile.Count;
         filePath = new string[ct1 + ct2];
         for (int i = 0; i < ct1; i++)
         {
             filePath[i] = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + cfg.SceneDslFile[i]);
         }
         for (int i = 0; i < ct2; i++)
         {
             filePath[ct1 + i] = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + cfg.ClientDslFile[i]);
         }
         StoryConfigManager.Instance.LoadStories(0, string.Empty, filePath);
         Dictionary <string, StoryInstance> stories = StoryConfigManager.Instance.GetStories(0);
         if (null != stories)
         {
             foreach (KeyValuePair <string, StoryInstance> pair in stories)
             {
                 AddStoryInstance(pair.Key, pair.Value.Clone());
             }
         }
     }
 }
Beispiel #2
0
    private static void CopyTableAndDslFiles()
    {
        string path = HomePath.GetAbsolutePath("..\\..\\..\\dslcopy.bat");

        System.Diagnostics.Process p = System.Diagnostics.Process.Start("cmd", string.Format("/c call {0} Debug False", path));
        p.WaitForExit();
    }
Beispiel #3
0
        private AiStoryInstanceInfo NewAiStoryInstance(string storyId, string _namespace, bool logIfNotFound, params string[] overloadFiles)
        {
            if (!string.IsNullOrEmpty(_namespace))
            {
                storyId = string.Format("{0}:{1}", _namespace, storyId);
            }
            AiStoryInstanceInfo instInfo = GetUnusedAiStoryInstanceInfoFromPool(storyId);

            if (null == instInfo)
            {
                int      ct;
                string[] filePath;
                ct       = overloadFiles.Length;
                filePath = new string[ct];
                for (int i = 0; i < ct; i++)
                {
                    filePath[i] = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + overloadFiles[i]);
                }
                StoryConfigManager.Instance.LoadStories(0, _namespace, filePath);
                StoryInstance instance = StoryConfigManager.Instance.NewStoryInstance(storyId, 0);
                if (instance == null)
                {
                    if (logIfNotFound)
                    {
                        LogSystem.Error("Can't load story config, story:{0} scene:{1} !", storyId, m_SceneId);
                    }
                    return(null);
                }
                for (int ix = 0; ix < filePath.Length; ++ix)
                {
                    Dictionary <string, StoryInstance> stories = StoryConfigManager.Instance.GetStories(filePath[ix]);
                    if (null != stories)
                    {
                        foreach (KeyValuePair <string, StoryInstance> pair in stories)
                        {
                            if (pair.Key != storyId)
                            {
                                AiStoryInstanceInfo info = new AiStoryInstanceInfo();
                                info.m_StoryInstance = pair.Value.Clone();
                                info.m_IsUsed        = false;
                                AddAiStoryInstanceInfoToPool(pair.Key, info);
                            }
                        }
                    }
                }
                AiStoryInstanceInfo res = new AiStoryInstanceInfo();
                res.m_StoryInstance = instance;
                res.m_IsUsed        = true;

                AddAiStoryInstanceInfoToPool(storyId, res);
                return(res);
            }
            else
            {
                instInfo.m_IsUsed = true;
                return(instInfo);
            }
        }
        public void LoadPatch(string patch_file)
        {
            MapPatchParser patchParser = new MapPatchParser();

            patchParser.Load(HomePath.GetAbsolutePath(patch_file));
            patchParser.VisitPatches((int row, int col, byte obstacle) =>
            {
                SetCellStatus(row, col, obstacle);
            });
        }
Beispiel #5
0
        private void LoadCustomCommandsAndValues()
        {
            string cmdFile = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + "Story/Common/CustomCommands.dsl");
            string valFile = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + "Story/Common/CustomValues.dsl");

            Dsl.DslFile file1 = CustomCommandValueParser.LoadStory(cmdFile);
            Dsl.DslFile file2 = CustomCommandValueParser.LoadStory(valFile);
            CustomCommandValueParser.FirstParse(file1, file2);
            CustomCommandValueParser.FinalParse(file1, file2);
        }
Beispiel #6
0
 public void Load(string file)
 {
     if (BinaryTable.IsValid(HomePath.GetAbsolutePath(file)))
     {
         m_LevelMonsterMgr.LoadFromBinary(file);
     }
     else
     {
         LogSystem.Error("LevelMonster is not a table !");
     }
 }
Beispiel #7
0
    private void CopyEditedSkillsToClipboard()
    {
        SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt"));

        string     text   = GetEditedSkillsText();
        TextEditor editor = new TextEditor();

        editor.text = text;
        //editor.content = new GUIContent(text);
        editor.OnFocus();
        editor.Copy();
    }
 public void LoadObstacle(string file, float scale)
 {
     if (!GlobalVariables.Instance.IsClient)
     {//客户端暂时不读避让信息(xml库在ios上有问题。。)
         float     mapwidth  = cell_manager_.GetMapWidth();
         float     mapheight = cell_manager_.GetMapHeight();
         MapParser mapParser = new MapParser();
         mapParser.ParseTiledData(HomePath.GetAbsolutePath(file), mapwidth * scale, mapheight * scale);
         mapParser.GenerateObstacleInfo(m_KdObstacleTree, scale);
     }
     m_KdObstacleTree.Build();
 }
        public void Load(string dslFile)
        {
            Dsl.DslFile file = new Dsl.DslFile();
            string      path = HomePath.GetAbsolutePath(dslFile);

            if (file.Load(path, LogSystem.Log))
            {
                foreach (Dsl.DslInfo info in file.DslInfos)
                {
                    Load(info);
                }
            }
        }
Beispiel #10
0
            private static FileStream LogFS(string key)
            {
                FileStream fs;

                if (!log_fs_.TryGetValue(key, out fs))
                {
                    string t    = DateTime.UtcNow.ToString("HH.mm.ss.fffffff");
                    string path = HomePath.GetAbsolutePath(string.Format("{0}_{1}.log", key, t));
                    fs = new FileStream(path, FileMode.CreateNew, FileAccess.Write, FileShare.Read);
                    log_fs_.Add(key, fs);
                }
                return(fs);
            }
Beispiel #11
0
 public void Init(string map_file, Vector3[] reachableSet)
 {
     map_file_ = map_file;
     if (!cell_manager_.Init(HomePath.GetAbsolutePath(map_file_)))
     {
         cell_manager_.Init(1024, 1024, 0.5f);
         LogSystem.Error("Init SpatialSystem from map file failed: {0}", map_file_);
     }
     if (null != reachableSet)
     {
         m_ReachableSet.Clear();
         m_ReachableSet.Build(reachableSet);
     }
 }
Beispiel #12
0
        public void PreloadNamespacedStory(string _namespace, string file)
        {
            string filePath = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + file);

            StoryConfigManager.Instance.LoadStories(0, _namespace, filePath);
            Dictionary <string, StoryInstance> stories = StoryConfigManager.Instance.GetStories(filePath);

            if (null != stories)
            {
                foreach (KeyValuePair <string, StoryInstance> pair in stories)
                {
                    AddStoryInstance(pair.Key, pair.Value.Clone());
                }
            }
        }
Beispiel #13
0
        public void PreloadAiStory(string _namespace, string file)
        {
            string filePath = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + file);

            StoryConfigManager.Instance.LoadStories(0, _namespace, filePath);
            Dictionary <string, StoryInstance> stories = StoryConfigManager.Instance.GetStories(filePath);

            if (null != stories)
            {
                foreach (KeyValuePair <string, StoryInstance> pair in stories)
                {
                    AiStoryInstanceInfo info = new AiStoryInstanceInfo();
                    info.m_StoryInstance = pair.Value.Clone();
                    info.m_IsUsed        = false;
                    AddAiStoryInstanceInfoToPool(pair.Key, info);
                }
            }
        }
Beispiel #14
0
        private void PreloadNewSkillInstance(int skillId)
        {
            SkillLogicData skillData = SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_SKILL, skillId) as SkillLogicData;

            if (null != skillData)
            {
                string filePath = HomePath.GetAbsolutePath(FilePathDefine_Client.C_SkillDslPath + skillData.SkillDataFile);
                SkillConfigManager.Instance.LoadSkillIfNotExist(skillId, filePath);
                SkillInstance inst = SkillConfigManager.Instance.NewSkillInstance(skillId);
                if (inst != null)
                {
                    SkillInstanceInfo res = new SkillInstanceInfo();
                    res.m_SkillId       = skillId;
                    res.m_SkillInstance = inst;
                    res.m_IsUsed        = true;
                    AddSkillInstanceInfoToPool(skillId, res);
                    RecycleSkillInstance(res);
                }
            }
        }
Beispiel #15
0
        private SkillInstanceInfo NewSkillInstance(int skillId)
        {
            SkillInstanceInfo instInfo = GetUnusedSkillInstanceInfoFromPool(skillId);

            if (null == instInfo)
            {
                SkillLogicData skillData = SkillConfigProvider.Instance.ExtractData(SkillConfigType.SCT_SKILL, skillId) as SkillLogicData;
                if (null != skillData)
                {
                    string filePath = HomePath.GetAbsolutePath(FilePathDefine_Server.C_SkillDslPath + skillData.SkillDataFile);
                    SkillConfigManager.Instance.LoadSkillIfNotExist(skillId, filePath);
                    SkillInstance inst = SkillConfigManager.Instance.NewSkillInstance(skillId);

                    if (null != inst)
                    {
                        SkillInstanceInfo res = new SkillInstanceInfo();
                        res.m_SkillId       = skillId;
                        res.m_SkillInstance = inst;
                        res.m_IsUsed        = true;

                        AddSkillInstanceInfoToPool(skillId, res);
                        return(res);
                    }
                    else
                    {
                        LogSystem.Error("Can't find skill dsl or skill dsl error, skill:{0} !", skillId);
                        return(null);
                    }
                }
                else
                {
                    LogSystem.Error("Can't find skill config, skill:{0} !", skillId);
                    return(null);
                }
            }
            else
            {
                instInfo.m_IsUsed = true;
                return(instInfo);
            }
        }
Beispiel #16
0
        public void PreLoadAllSkills()
        {
            MyDictionary <int, object> datacont = SkillConfigProvider.Instance.skillLogicDataMgr.GetData();

            foreach (KeyValuePair <int, object> pair in datacont)
            {
                int            id        = pair.Key;
                SkillLogicData skillData = pair.Value as SkillLogicData;

                string filePath = HomePath.GetAbsolutePath(FilePathDefine_Client.C_SkillDslPath + skillData.SkillDataFile);
                if (!String.IsNullOrEmpty(filePath))
                {
                    if (File.Exists(filePath))
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            PreloadNewSkillInstance(id);
                        }
                    }
                }
            }
        }
Beispiel #17
0
        public void Init()
        {
            ArkCrossEngine.RoleInfo ri = ArkCrossEngine.LobbyClient.Instance.CurrentRole;
            if (ri != null)
            {
                Data_PlayerConfig cg = PlayerConfigProvider.Instance.GetPlayerConfigById(ri.HeroId);
                if (cg != null)
                {
                    herostr = cg.m_Portrait;
                }
                heroname = ri.Nickname;
            }
            m_StoryInfos.Clear();
            DBC dlgCfg = new DBC();

            if (dlgCfg.Load(HomePath.GetAbsolutePath(FilePathDefine_Client.C_DialogConfig)))
            {
                for (int index = 0; index < dlgCfg.RowNum; index++)
                {
                    DBC_Row node = dlgCfg.GetRowByIndex(index);
                    if (null != node)
                    {
                        StoryDlgInfo info = new StoryDlgInfo();
                        info.ID           = DBCUtil.ExtractNumeric <int>(node, "Id", 0, true);
                        info.StoryName    = DBCUtil.ExtractString(node, "StoryName", "", true);
                        info.DlgType      = (StoryDlgPanel.StoryDlgType)DBCUtil.ExtractNumeric <int>(node, "DlgType", 0, true);
                        info.IntervalTime = DBCUtil.ExtractNumeric <float>(node, "IntervalTime", 1.0f, true);
                        info.StoryItems   = BuildStoryItems(info.StoryName);
                        if (!m_StoryInfos.ContainsKey(info.ID))
                        {
                            m_StoryInfos.Add(info.ID, info);
                        }
                    }
                }
            }
        }
Beispiel #18
0
        private List <StoryDlgItem> BuildStoryItems(string storyName)
        {
            DBC    storyItems = new DBC();
            string str        = String.Format("{0}{1}.txt", FilePathDefine_Client.C_DialogPath, storyName.Trim());

            if (storyItems.Load(HomePath.GetAbsolutePath(str)))
            {
                List <StoryDlgItem> itemList = new List <StoryDlgItem>();
                for (int index = 0; index < storyItems.RowNum; index++)
                {
                    DBC_Row node = storyItems.GetRowByIndex(index);
                    if (null != node)
                    {
                        StoryDlgItem item = new StoryDlgItem();
                        item.Number       = DBCUtil.ExtractNumeric <int>(node, "Number", 0, true);
                        item.UnitId       = DBCUtil.ExtractNumeric <int>(node, "UnitId", -1, false);
                        item.IntervalTime = DBCUtil.ExtractNumeric <float>(node, "IntervalTime", 0f, false);
                        item.SpeakerName  = DBCUtil.ExtractString(node, "SpeakerName", "", true);
                        if (item.SpeakerName.Contains("player"))
                        {
                            item.SpeakerName = item.SpeakerName.Replace("player", heroname);
                        }
                        item.ImageLeftAtlas = DBCUtil.ExtractString(node, "ImageLeftAtlas", "", false);
                        item.ImageLeft      = DBCUtil.ExtractString(node, "ImageLeft", "", true);
                        if (item.ImageLeft.Contains("player"))
                        {
                            item.ImageLeft = item.ImageLeft.Replace("player", herostr);
                        }
                        item.ImageLeftBig    = string.Format("{0}_big", item.ImageLeft);
                        item.ImageLeftSmall  = string.Format("{0}_small", item.ImageLeft);
                        item.ImageRightAtlas = DBCUtil.ExtractString(node, "ImageRightAtlas", "", false);
                        item.ImageRight      = DBCUtil.ExtractString(node, "ImageRight", "", true);
                        if (item.ImageRight.Contains("player"))
                        {
                            item.ImageRight = item.ImageRight.Replace("player", herostr);
                        }
                        item.ImageRightBig   = string.Format("{0}_big", item.ImageRight);
                        item.ImageRightSmall = string.Format("{0}_small", item.ImageRight);
                        item.Words           = DBCUtil.ExtractString(node, "Words", "", true);
                        if (item.Words.Contains("player"))
                        {
                            item.Words = item.Words.Replace("player", heroname);
                        }
                        item.TextureAnimationPath = DBCUtil.ExtractString(node, "TexturePath", "", false);
                        //TweenPos
                        item.FromOffsetBottom = DBCUtil.ExtractNumeric <float>(node, "FromOffsetBottom", 0, false);
                        item.FromOffsetLeft   = DBCUtil.ExtractNumeric <float>(node, "FromOffsetLeft", 0, false);
                        item.ToOffsetBottom   = DBCUtil.ExtractNumeric <float>(node, "ToOffsetBottom", 0, false);
                        item.ToOffsetLeft     = DBCUtil.ExtractNumeric <float>(node, "ToOffsetLeft", 0, false);
                        item.TweenPosDelay    = DBCUtil.ExtractNumeric <float>(node, "TweenPosDelay", 0, false);
                        item.TweenPosDuration = DBCUtil.ExtractNumeric <float>(node, "TweenPosDuration", 0, false);
                        //TweenScale
                        item.FromScale          = DBCUtil.ExtractNumeric <float>(node, "FromScale", 1, false);
                        item.ToScale            = DBCUtil.ExtractNumeric <float>(node, "ToScale", 1, false);
                        item.TweenScaleDelay    = DBCUtil.ExtractNumeric <float>(node, "TweenScaleDelay", 0, false);
                        item.TweenScaleDuration = DBCUtil.ExtractNumeric <float>(node, "TweenScaleDuration", 0, false);
                        //TweenAlpha
                        item.FromAlpha          = DBCUtil.ExtractNumeric <float>(node, "FromAlpha", 1, false);
                        item.ToAlpha            = DBCUtil.ExtractNumeric <float>(node, "ToAlpha", 1, false);
                        item.TweenAlphaDelay    = DBCUtil.ExtractNumeric <float>(node, "TweenAlphaDelay", 0, false);
                        item.TweenAlphaDuration = DBCUtil.ExtractNumeric <float>(node, "TweenAlphaDuration", 0, false);
                        //显示字的速度
                        item.WordDuration = DBCUtil.ExtractNumeric <float>(node, "WordDuration", 0, false);

                        itemList.Add(item);
                    }
                }
                return(itemList);
            }
            return(null);
        }
Beispiel #19
0
    private void LoadEditedSkills(int targetId)
    {
        PlayerPrefs.SetInt("TargetId", targetId);
        PlayerPrefs.Save();

        SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt"));
        CopyTableAndDslFiles();

        PluginFramework.LoadTableConfig();
        PredefinedSkill.Instance.ReBuild();
        GfxSkillSystem.Instance.Reset();
        GfxSkillSystem.Instance.ClearSkillInstancePool();
        SkillSystem.SkillConfigManager.Instance.Clear();

        GameObject actor  = GameObject.Find("Editor_ActorRecord");
        GameObject skills = GameObject.Find("Editor_SkillRecords");

        if (null != actor && null != skills)
        {
            ActorRecord  actorRecord  = actor.GetComponent <ActorRecord>();
            SkillRecords skillRecords = skills.GetComponent <SkillRecords>();
            if (null != actorRecord && null != skillRecords)
            {
                List <int> args    = new List <int>();
                int        actorId = actorRecord.id;
                if (actorRecord.skill0 > 0)
                {
                    args.Add(actorRecord.skill0);
                }
                if (actorRecord.skill1 > 0)
                {
                    args.Add(actorRecord.skill1);
                }
                if (actorRecord.skill2 > 0)
                {
                    args.Add(actorRecord.skill2);
                }
                if (actorRecord.skill3 > 0)
                {
                    args.Add(actorRecord.skill3);
                }
                if (actorRecord.skill4 > 0)
                {
                    args.Add(actorRecord.skill4);
                }
                if (actorRecord.skill5 > 0)
                {
                    args.Add(actorRecord.skill5);
                }
                if (actorRecord.skill6 > 0)
                {
                    args.Add(actorRecord.skill6);
                }
                if (actorRecord.skill7 > 0)
                {
                    args.Add(actorRecord.skill7);
                }
                if (actorRecord.skill8 > 0)
                {
                    args.Add(actorRecord.skill8);
                }

                RebuildVisualSkillInfo(actorId);

                bool isValid = true;
                if (string.IsNullOrEmpty(actorRecord.avatar))
                {
                    Debug.LogErrorFormat("actor avatar is empty !!!");
                    isValid = false;
                }
                foreach (int skillId in args)
                {
                    CheckEditedSkill(skillId, skillRecords.records, ref isValid);
                }
                if (isValid)
                {
                    TableConfig.Actor actorInfo = TableConfig.ActorProvider.Instance.GetActor(actorId);
                    if (null == actorInfo)
                    {
                        actorInfo    = new TableConfig.Actor();
                        actorInfo.id = actorId;
                        TableConfig.ActorProvider.Instance.ActorMgr.GetData().Add(actorId, actorInfo);
                    }
                    actorRecord.CopyTo(actorInfo);

                    foreach (SkillRecords.SkillRecord record in skillRecords.records)
                    {
                        TableConfig.Skill skillInfo = TableConfig.SkillProvider.Instance.GetSkill(record.id);
                        if (null == skillInfo)
                        {
                            skillInfo    = new TableConfig.Skill();
                            skillInfo.id = record.id;
                            TableConfig.SkillProvider.Instance.SkillMgr.GetData().Add(record.id, skillInfo);
                        }
                        record.CopyTo(skillInfo);
                    }

                    if (args.Count > 1)
                    {
                        GfxStorySystem.Instance.SendMessage("reload", actorId, targetId, BoxedValue.From(args));
                    }
                }
            }

            UnityEditor.EditorUtility.DisplayDialog("提示", "编辑英雄与技能加载完毕", "ok");
        }
    }
Beispiel #20
0
    private void NewEditedSkills()
    {
        if (UnityEditor.EditorUtility.DisplayDialog("关键信息", "加载或创建英雄技能数据将覆盖正在编辑的数据,继续吗?(如果之前的数据没有保存到表格文件里,请利用剪贴板拷到表格文件!)", "我确定要继续", "不要继续,我还没保存呢"))
        {
            SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt"));

            PluginFramework.LoadTableConfig();
            PredefinedSkill.Instance.ReBuild();
            GfxSkillSystem.Instance.Reset();
            GfxSkillSystem.Instance.ClearSkillInstancePool();
            SkillSystem.SkillConfigManager.Instance.Clear();

            GameObject actor  = GameObject.Find("Editor_ActorRecord");
            GameObject skills = GameObject.Find("Editor_SkillRecords");
            if (null != actor && null != skills)
            {
                ActorRecord  actorRecord  = actor.GetComponent <ActorRecord>();
                SkillRecords skillRecords = skills.GetComponent <SkillRecords>();
                if (null != actorRecord && null != skillRecords)
                {
                    int        skillCount = 0;
                    List <int> skillIds   = new List <int>();
                    if (actorRecord.skill0 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill0);
                    }
                    if (actorRecord.skill1 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill1);
                    }
                    if (actorRecord.skill2 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill2);
                    }
                    if (actorRecord.skill3 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill3);
                    }
                    if (actorRecord.skill4 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill4);
                    }
                    if (actorRecord.skill5 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill5);
                    }
                    if (actorRecord.skill6 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill6);
                    }
                    if (actorRecord.skill7 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill7);
                    }
                    if (actorRecord.skill8 > 0)
                    {
                        ++skillCount; skillIds.Add(actorRecord.skill8);
                    }

                    RebuildVisualSkillInfo(actorRecord.id);

                    skillRecords.records.Clear();
                    for (int i = 0; i < skillCount; ++i)
                    {
                        AddViewedSkill(skillIds[i], skillRecords.records);
                    }
                }
            }
        }

        UnityEditor.EditorUtility.DisplayDialog("提示", "技能数据加载/创建完毕", "ok");
    }
Beispiel #21
0
    private void LoadViewedSkills(object[] fargs)
    {
        if (null != fargs && fargs.Length == 2)
        {
            int actorId  = (int)fargs[0];
            int targetId = (int)fargs[1];

            PlayerPrefs.SetInt("ActorId", actorId);
            PlayerPrefs.SetInt("TargetId", targetId);
            PlayerPrefs.Save();

            if (UnityEditor.EditorUtility.DisplayDialog("关键信息", "从文件加载数据将同时覆盖正在编辑的数据,继续吗?(如果之前的数据没有保存到表格文件里,请利用剪贴板拷到表格文件!)", "我确定要继续", "不要继续,我还没保存呢"))
            {
                SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt"));
                CopyTableAndDslFiles();
                m_CameraController.OnLevelWasLoaded(null);
                PluginFramework.LoadTableConfig();
                PredefinedSkill.Instance.ReBuild();
                GfxSkillSystem.Instance.Reset();
                GfxSkillSystem.Instance.ClearSkillInstancePool();
                SkillSystem.SkillConfigManager.Instance.Clear();

                GameObject actor  = GameObject.Find("Editor_ActorRecord");
                GameObject skills = GameObject.Find("Editor_SkillRecords");
                if (null != actor && null != skills)
                {
                    ActorRecord  actorRecord  = actor.GetComponent <ActorRecord>();
                    SkillRecords skillRecords = skills.GetComponent <SkillRecords>();
                    if (null != actorRecord && null != skillRecords)
                    {
                        TableConfig.Actor actorInfo = TableConfig.ActorProvider.Instance.GetActor(actorId);
                        if (null != actorInfo)
                        {
                            List <int> args = new List <int>();
                            if (actorInfo.skill0 > 0)
                            {
                                args.Add(actorInfo.skill0);
                            }
                            if (actorInfo.skill1 > 0)
                            {
                                args.Add(actorInfo.skill1);
                            }
                            if (actorInfo.skill2 > 0)
                            {
                                args.Add(actorInfo.skill2);
                            }
                            if (actorInfo.skill3 > 0)
                            {
                                args.Add(actorInfo.skill3);
                            }
                            if (actorInfo.skill4 > 0)
                            {
                                args.Add(actorInfo.skill4);
                            }
                            if (actorInfo.skill5 > 0)
                            {
                                args.Add(actorInfo.skill5);
                            }
                            if (actorInfo.skill6 > 0)
                            {
                                args.Add(actorInfo.skill6);
                            }
                            if (actorInfo.skill7 > 0)
                            {
                                args.Add(actorInfo.skill7);
                            }
                            if (actorInfo.skill8 > 0)
                            {
                                args.Add(actorInfo.skill8);
                            }

                            RebuildVisualSkillInfo(actorId);

                            actorRecord.CopyFrom(actorInfo);

                            skillRecords.records.Clear();
                            foreach (int skillId in args)
                            {
                                AddViewedSkill(skillId, skillRecords.records);
                            }

                            GfxStorySystem.Instance.SendMessage("reload", actorId, targetId, BoxedValue.From(args));
                        }
                    }
                }

                UnityEditor.EditorUtility.DisplayDialog("提示", "从文件加载英雄与技能完毕", "ok");
            }
        }
    }
Beispiel #22
0
        private StoryInstance NewStoryInstance(string storyId, string _namespace, bool logIfNotFound, params string[] overloadFiles)
        {
            if (!string.IsNullOrEmpty(_namespace))
            {
                storyId = string.Format("{0}:{1}", _namespace, storyId);
            }
            StoryInstance instance = GetStoryInstance(storyId);

            if (null == instance)
            {
                TableConfig.Level cfg = TableConfig.LevelProvider.Instance.GetLevel(m_SceneId);
                if (null != cfg)
                {
                    string[] filePath;
                    if (overloadFiles.Length <= 0)
                    {
                        int ct1 = cfg.SceneDslFile.Count;
                        int ct2 = cfg.ClientDslFile.Count;
                        filePath = new string[ct1 + ct2];
                        for (int i = 0; i < ct1; i++)
                        {
                            filePath[i] = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + cfg.SceneDslFile[i]);
                        }
                        for (int i = 0; i < ct2; i++)
                        {
                            filePath[ct1 + i] = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + cfg.ClientDslFile[i]);
                        }
                    }
                    else
                    {
                        int ct = overloadFiles.Length;
                        filePath = new string[ct];
                        for (int i = 0; i < ct; i++)
                        {
                            filePath[i] = HomePath.GetAbsolutePath(FilePathDefine_Client.C_DslPath + overloadFiles[i]);
                        }
                    }
                    StoryConfigManager.Instance.LoadStories(0, _namespace, filePath);
                    instance = StoryConfigManager.Instance.NewStoryInstance(storyId, 0);
                    if (instance == null)
                    {
                        if (logIfNotFound)
                        {
                            LogSystem.Error("Can't load story config, story:{0} scene:{1} !", storyId, m_SceneId);
                        }
                        return(null);
                    }
                    for (int ix = 0; ix < filePath.Length; ++ix)
                    {
                        Dictionary <string, StoryInstance> stories = StoryConfigManager.Instance.GetStories(filePath[ix]);
                        if (null != stories)
                        {
                            foreach (KeyValuePair <string, StoryInstance> pair in stories)
                            {
                                if (pair.Key != storyId)
                                {
                                    AddStoryInstance(pair.Key, pair.Value.Clone());
                                }
                            }
                        }
                    }
                    AddStoryInstance(storyId, instance);
                    return(instance);
                }
                else
                {
                    if (logIfNotFound)
                    {
                        LogSystem.Error("Can't find story config, story:{0} scene:{1} !", storyId, m_SceneId);
                    }
                    return(null);
                }
            }
            else
            {
                return(instance);
            }
        }