示例#1
0
    private void DeserializeData(string file)
    {
        _hoster.ConfigData = XDataIO <XConfigData> .singleton.DeserializeData(XEditorLibrary.GetCfgFromSkp(file));

        _hoster.SkillData = XDataIO <XSkillData> .singleton.DeserializeData(file);

        XDataBuilder.singleton.HotBuildEx(_hoster, _hoster.ConfigData);
    }
示例#2
0
        public void Load(string pathwithname)
        {
            try
            {
                string      path = XEditorLibrary.GetCfgFromSkp(pathwithname);
                XConfigData conf = XDataIO <XConfigData> .singleton.DeserializeData(path);

                GameObject prefab = XEditorLibrary.GetDummy((uint)conf.Player);
                if (prefab == null)
                {
                    XDebug.LogError("Prefab not found by id: ", conf.Player); return;
                }
                ColdBuild(prefab, conf);
                prefixPath = pathwithname.Substring(0, pathwithname.IndexOf("/Skill"));
                Time       = File.GetLastWriteTime(pathwithname);
            }
            catch (Exception e)
            {
                XDebug.LogError("Error occurred during loading config file: ", pathwithname, " with error:\n", e.StackTrace);
            }
        }
示例#3
0
        public void Update(XSkillHoster hoster)
        {
            string   pathwithname = hoster.SkillDataExtra.ScriptPath + hoster.ConfigData.SkillName + ".txt";
            DateTime time         = File.GetLastWriteTime(pathwithname);

            if (Time == default(DateTime))
            {
                Time = time;
            }

            if (time != Time)
            {
                Time = time;
                if (EditorUtility.DisplayDialog("WARNING!",
                                                "Skill has been Modified outside, Press 'OK' to reload file or 'Ignore' to maintain your change. (Make sure the '.config' file for skill script has been well synchronized)",
                                                "Ok", "Ignore"))
                {
                    hoster.ConfigData = XDataIO <XConfigData> .singleton.DeserializeData(XEditorLibrary.GetCfgFromSkp(pathwithname));

                    hoster.SkillData = XDataIO <XSkillData> .singleton.DeserializeData(pathwithname);

                    HotBuildEx(hoster, hoster.ConfigData);
                }
            }
        }
示例#4
0
    private void SerializeData(string file)
    {
        _hoster.SkillData.Name = _hoster.SkillDataExtra.ScriptFile;

        if (_hoster.SkillData.TypeToken != 2)
        {
            string path = AssetDatabase.GetAssetPath(_hoster.SkillDataExtra.SkillClip).Remove(0, 17);
            _hoster.SkillData.ClipName = path.Remove(path.LastIndexOf('.'));
        }
        else
        {
            _hoster.SkillData.ClipName = null;
        }

        if (_hoster.SkillData.TypeToken != 0)
        {
            _hoster.SkillData.Ja = null;
        }

        if (_hoster.SkillData.Result != null)
        {
            foreach (XResultData data in _hoster.SkillData.Result)
            {
                if (data.Warning)
                {
                    if (_hoster.SkillData.Warning == null || data.Warning_Idx >= _hoster.SkillData.Warning.Count)
                    {
                        EditorUtility.DisplayDialog("Confirm your configuration.", "Please select right Warning Index!", "Ok");
                        return;
                    }
                }
            }
        }

        if (_hoster.SkillData.Warning != null)
        {
            for (int idx = 0; idx < _hoster.SkillData.Warning.Count; idx++)
            {
                int i = 0;
                for (; i < _hoster.SkillData.Result.Count; i++)
                {
                    if (_hoster.SkillData.Result[i].Warning && _hoster.SkillData.Result[i].Warning_Idx == idx)
                    {
                        break;
                    }
                }
                if (i == _hoster.SkillData.Result.Count)
                {
                    EditorUtility.DisplayDialog("Confirm your configuration.", "Please MATCH your Results' and Warnings' Index!", "Ok");
                    return;
                }
            }
        }

        if (!((_hoster.SkillData.Result == null && _hoster.SkillData.Hit == null) || _hoster.SkillData.Result.Count == _hoster.SkillData.Hit.Count))
        {
            EditorUtility.DisplayDialog("Confirm your configuration.", "Result count is not match with Hit count!", "Ok");
            return;
        }

        if (_hoster.SkillData.Hit != null)
        {
            int idx = 0;
            for (; idx < _hoster.SkillData.Hit.Count; idx++)
            {
                if (((_hoster.SkillData.Hit[idx].State == XBeHitState.Hit_Back || _hoster.SkillData.Hit[idx].State == XBeHitState.Hit_Roll) &&
                     (_hoster.SkillData.Hit[idx].Time_Present_Straight == 0 || _hoster.SkillData.Hit[idx].Time_Hard_Straight == 0 || _hoster.SkillData.Hit[idx].Offset == 0)) ||
                    (_hoster.SkillData.Hit[idx].Height == 0 && _hoster.SkillData.Hit[idx].State == XBeHitState.Hit_Fly) ||
                    (_hoster.SkillData.Hit[idx].FreezeDuration == 0 && _hoster.SkillData.Hit[idx].State == XBeHitState.Hit_Freezed))
                {
                    break;
                }
            }
            if (idx < _hoster.SkillData.Hit.Count)
            {
                EditorUtility.DisplayDialog("Confirm your configuration.", "your Hit parameters == 0!", "Ok");
                return;
            }
        }

        StripData(_hoster.SkillData);
        XDataIO <XSkillData> .singleton.SerializeData(file, _hoster.SkillData);

        XDataIO <XConfigData> .singleton.SerializeData(XEditorLibrary.GetCfgFromSkp(file), _hoster.ConfigData);

        XDataBuilder.Time = File.GetLastWriteTime(file);
    }