Ejemplo n.º 1
0
    // Start is called before the first frame update
    private void Awake()
    {
        canvas = GameObject.Find("Canvas");
        //heros = GameObject.FindGameObjectsWithTag("Hero");
        heros = GetHeros();
        //HerosJson herosjson = JsonManager.loadFromResource<HerosJson>("hero");
        //Debug.Log(herosjson.heros[0].hp);

        monsters = GameObject.FindGameObjectsWithTag("Monster");
        object[] objSkillButtons = GameObject.FindObjectsOfType <Skill_Button>();
        skillButtons = new GameObject[objSkillButtons.Length];
        for (int i = 0; i < skillButtons.Length; i++)
        {
            skillButtons[i] = (objSkillButtons[i] as Skill_Button).gameObject;
        }
        Array.Sort(skillButtons, (a, b) => a.name.CompareTo(b.name));
        object[] objContainCreture = GameObject.FindObjectsOfType <Creture>();
        gameObjects = new GameObject[objContainCreture.Length];
        for (int i = 0; i < gameObjects.Length; i++)
        {
            gameObjects[i] = (objContainCreture[i] as Creture).gameObject;
        }
        actionList = new List <GameObject>(gameObjects);
        actionListSort();
        TextAsset t         = Resources.Load <TextAsset>("skill.sprite.path");
        string    json      = t.text;
        SkillJson skillJson = JsonUtility.FromJson <SkillJson>(json);

        for (int i = 0; i < skillJson.SkillList.Count; i++)
        {
            sprites.Add(skillJson.SkillList[i].name, Resources.Load <Sprite>(skillJson.SkillList[i].path));
        }
    }
Ejemplo n.º 2
0
        public static void AddResumeData(ResumeDbContext context, string dateFolder)
        {
            try
            {
                if (dateFolder[0] == 'd')
                {
                    ResumeFiles files = new ResumeFiles(dateFolder);

                    // Utilities.LoadType<Resume>(context, files.Resume, writeJson);

                    if (File.Exists(files.Resume))
                    {
                        Resume resume = Utilities.SerializeYml <Resume>(files.Resume);
                        context.Add(resume);
                    }

                    if (File.Exists(files.Education))
                    {
                        EducationJson     educationJson = Utilities.SerializeYml <EducationJson>(files.Education);
                        IList <Education> educations    = educationJson.Educations;
                        AddItems(context, educations);
                    }
                    if (File.Exists(files.Job))
                    {
                        JobJson     jobJson = Utilities.SerializeYml <JobJson>(files.Job);
                        IList <Job> jobs    = jobJson.Jobs;
                        AddItems(context, jobs);
                    }
                    if (File.Exists(files.Skill))
                    {
                        SkillJson     skillJson = Utilities.SerializeYml <SkillJson>(files.Skill);
                        IList <Skill> skills    = skillJson.Skills;
                        AddItems(context, skills);
                    }
                    if (File.Exists(files.Social))
                    {
                        SocialJson     socialJson = Utilities.SerializeYml <SocialJson>(files.Social);
                        IList <Social> socials    = socialJson.Socials;
                        AddItems(context, socials);
                    }
                    if (File.Exists(files.SpokenLanguages))
                    {
                        SpokenLanguagesJson     spokenLanguagesJson = Utilities.SerializeYml <SpokenLanguagesJson>(files.SpokenLanguages);
                        IList <SpokenLanguages> spokenLanguages     = spokenLanguagesJson.SpokenLanguages;
                        AddItems(context, spokenLanguages);
                    }

                    context.SaveChanges();
                }
            }

            catch (Exception e)
            {
                Console.WriteLine("##############################");
                Console.WriteLine("Resume Data Add Fail");
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 3
0
        private void HandleSkill(SkillCom skillCom)
        {
            //没有技能释放请求
            if (skillCom.SkillId <= 0)
            {
                return;
            }

            //生成一个时间线
            if (skillCom.Line == null)
            {
                skillCom.Line = TimeLineHelp.CreateTimeLine();
            }
            else
            {
                skillCom.Line = TimeLineHelp.AddTimeLine(skillCom.Line);
            }

            //重置
            skillCom.Line.ReSet();

            SkillJson json = GameConfigHelp.GetSkillInfo(skillCom.SkillId);

            //播放动画
            for (int i = 0; i < json.AnimClips.Count; i++)
            {
                SkillAnimJson animJson = json.AnimClips[i];
                skillCom.Line.AddTrack((float)animJson.Time, 0).OnStart(() => {
                    PlayAnim(skillCom, animJson.AnimName);
                });
            }
            //播放特效
            for (int i = 0; i < json.Effects.Count; i++)
            {
                SkillEffectJson effectJson = json.Effects[i];
                skillCom.Line.AddTrack((float)effectJson.Time, 0).OnStart(() => {
                    PlayEffect(skillCom, effectJson);
                });
            }
            //播放音效
            for (int i = 0; i < json.Audios.Count; i++)
            {
                SkillAudioJson audioJson = json.Audios[i];
                skillCom.Line.AddTrack((float)audioJson.Time, 0).OnStart(() => {
                    PlayAudio(skillCom, audioJson.AudioId);
                });
            }
            //处理数据
            HandleSkillData(skillCom, json.Data);

            //开始播放技能
            skillCom.Line.Start();

            //重置
            skillCom.SkillId = 0;
        }
Ejemplo n.º 4
0
    public void OnShow(string skillid, int availableSkillPoint, string charid)
    {
        skillId = skillid;
        SkillJson skill = DataManager.Instance.SearchSkillID(skillid);

        if (skill != null)
        {
            icon.sprite          = Resources.Load <Sprite>(skill.imgPath);
            nameText.text        = skill.name;
            descriptionText.text = skill.tooltips;
        }
        int pos = PlayerManager.Instance.ReturnCharacterPosById(charid);

        button.interactable = (availableSkillPoint > 0 &&
                               !PlayerManager.Instance.Characters[pos].IsSkillLeanred(skillid)) ? true : false;
    }
Ejemplo n.º 5
0
        public static void Seed(ResumeDbContext context)
        {
            AddItems(context, EducationJson.LoadJson("Data/Seed/carlos_resume_educations.json").Educations);
            AddItems(context, JobJson.LoadJson("Data/Seed/carlos_resume_jobs.json").Jobs);
            context.Add(Resume.LoadJson("Data/Seed/carlos_resume_about.json"));
            AddItems(context, SkillJson.LoadJson("Data/Seed/carlos_resume_skills.json").Skills);
            AddItems(context, SocialJson.LoadJson("Data/Seed/carlos_resume_socials.json").Socials);
            AddItems(context, SpokenLanguagesJson.LoadJson("Data/Seed/carlos_resume_languages.json").SpokenLanguages);
            context.SaveChanges();

            AddItems(context, ResumeEducationsJson.LoadJson("Data/Seed/carlos_resume_resumeeducations.json").ResumeEducations);
            AddItems(context, ResumeJobsJson.LoadJson("Data/Seed/carlos_resume_resumejobs.json").ResumeJobs);
            AddItems(context, ResumeSkillsJson.LoadJson("Data/Seed/carlos_resume_resumeskills.json").ResumeSkills);
            AddItems(context, ResumeSocialsJson.LoadJson("Data/Seed/carlos_resume_resumesocials.json").ResumeSocials);
            AddItems(context, ResumeSpokenLanguagesJson.LoadJson("Data/Seed/carlos_resume_resumespokenlanguages.json").ResumeSpokenLanguages);
            context.SaveChanges();
        }
Ejemplo n.º 6
0
        public void UpdateSkill(SkillJson skill)
        {
            Level first = skill.Levels.First();
            Level last  = skill.Levels.Last();

            SkillName        = first.Name;
            SkillDescription = ArknightUtil.ReplaceSkillDesc(skill.Levels.First().Description, first.Blackboard, last.Blackboard);
            SkillType        = first.SkillType;
            SpType           = first.SpData.SpType;
            ChargeTime       = first.SpData.MaxChargeTime;
            MaxChargeTime    = last.SpData.MaxChargeTime;
            SpCost           = first.SpData.SpCost;
            MaxSpCost        = last.SpData.SpCost;
            Increment        = first.SpData.Increment;
            Duration         = first.Duration;
            MaxDuration      = last.Duration;
            RangeId          = first.RangeId;
        }
Ejemplo n.º 7
0
    // 主角攻击  速度10 + 10帧?
    IEnumerator _playStep(Data_MapBattle_R.StepData stepdata)
    {
        BattlePlayer battler = m_players[stepdata.chaBattleId];

        if (stepdata.skill == 61010)            // 技能1
        {
            Animation attackAnim = battler.gameObject.GetComponent <Animation>();
            ActiveAnimation.Play(attackAnim, "attack", AnimationOrTween.Direction.Forward);
            int iFrameCount = playSkillEffect(battler.transform, 61010);              //
            yield return(new WaitForSeconds(Time.deltaTime * iFrameCount));

            Data_MapBattle_R.StepData_Enemy[] enemys = stepdata.enemyChaArr;
            BattlePlayer enemy = null;
            for (int i = 0; i < enemys.Length; i++)                // 敌人受伤
            {
                enemy = m_players[enemys[i].enemyBattleId];
                enemy.ChangeHP(enemys[i].enemyChangeHp);
                iFrameCount = playSkillEffect(enemy.transform, 61011);                  //
            }
            yield return(new WaitForSeconds(Time.deltaTime * iFrameCount));
        }
        else            // 其他技能
        {
            SkillJson skill       = Globals.It.SkillJsonMgr.GetSkill(stepdata.skill);
            int       iFrameCount = playSkillEffect(battler.transform, skill.releaseEffect);        //
            yield return(new WaitForSeconds(Time.deltaTime * iFrameCount));

            Data_MapBattle_R.StepData_Enemy[] enemys = stepdata.enemyChaArr;
            BattlePlayer enemy      = null;
            int          iTempCount = 0;
            iFrameCount = 0;
            for (int i = 0; i < enemys.Length; i++)
            {
                enemy = m_players[enemys[i].enemyBattleId];
                enemy.ChangeHP(enemys[i].enemyChangeHp);
                iTempCount = playSkillEffect(enemy.transform, skill.effect);                  //
                if (iTempCount > iFrameCount)
                {
                    iFrameCount = iTempCount;
                }
            }
            yield return(new WaitForSeconds(Time.deltaTime * iFrameCount));
        }
    }
Ejemplo n.º 8
0
    private void OnDestroy()
    {
        List <SkillJson> skills = new List <SkillJson>();

        foreach (var item in skillsList)
        {
            SkillJson json = new SkillJson();
            json.name = item.Key;
            foreach (var ite in item.Value)
            {
                if (ite is AnimComponent)
                {
                    if (!json.skills.ContainsKey("动画"))
                    {
                        json.skills.Add("动画", new List <string>());
                    }
                    json.skills["动画"].Add(ite.name);
                }
                if (ite is AudioComponent)
                {
                    if (!json.skills.ContainsKey("音效"))
                    {
                        json.skills.Add("音效", new List <string>());
                    }
                    json.skills["音效"].Add(ite.name);
                }
                if (ite is EffectsComponent)
                {
                    if (!json.skills.ContainsKey("特效"))
                    {
                        json.skills.Add("特效", new List <string>());
                    }
                    json.skills["特效"].Add(ite.name);
                }
            }
            skills.Add(json);
        }
        string str = JsonConvert.SerializeObject(skills);

        File.WriteAllText("Assets/" + gameObject.name + ".txt", str);
        AssetDatabase.Refresh();
    }
Ejemplo n.º 9
0
 public override void Parse(Object asset)
 {
     if (asset != null && asset is TextAsset)
     {
         TextAsset          textAsset = (TextAsset)asset;
         string             sJson     = textAsset.text;
         LitJson.JsonReader jsonR     = new LitJson.JsonReader(sJson);
         LitJson.JsonData   jsonD     = LitJson.JsonMapper.ToObject(jsonR);
         int iCount = jsonD.Count;
         for (int i = 0; i < iCount; i++)             // 将解析到的数据放到dict
         {
             LitJson.JsonData itemData = jsonD[i];
             if (itemData == null)
             {
                 continue;
             }
             SkillJson jsonItem = SkillJson.Parse(itemData);
             m_jsons.Add(jsonItem.skillId, jsonItem);
         }
         Globals.It.BundleMgr.UnLoadBundleLocal(asset);
     }
 }
Ejemplo n.º 10
0
    // Start is called before the first frame update

    public object GetJsonObj(string jsonTag)
    {
        object jsonObj = null;

        switch (jsonTag)
        {
        case "enemy":
            EnemyJson enemyJson = new EnemyJson();
            jsonObj = enemyJson.GetEnemyJson();
            break;

        case "skill":
            SkillJson skillJson = new SkillJson();
            jsonObj = skillJson.GetSkillJson();
            break;

        case "buff":
            BuffJson buffJson = new BuffJson();
            jsonObj = buffJson.getBuffJson();
            break;
        }
        return(jsonObj);
    }
Ejemplo n.º 11
0
    // Start is called before the first frame update

    public object getJsonObj(string jsonTag)
    {
        object jsonObj = null;

        switch (jsonTag)
        {
        case "monster":
            MonsterJson monsterJson = new MonsterJson();
            jsonObj = monsterJson.getMonsterJson();
            break;

        case "skill":
            SkillJson skillJson = new SkillJson();
            jsonObj = skillJson.getSkillJson();
            break;

        case "buff":
            BuffJson buffJson = new BuffJson();
            jsonObj = buffJson.getBuffJson();
            break;
        }
        return(jsonObj);
    }
Ejemplo n.º 12
0
    // 解析技能
    public static SkillJson Parse(LitJson.JsonData data)
    {
        SkillJson json = new SkillJson();

        try {
            json.weaponRequied     = (int)data["weaponRequied"];
            json.skillName         = (string)data["skillName"];
            json.rangeType         = (int)data["rangeType"];
            json.releaseType       = (int)data["releaseType"];
            json.levelUpMoney      = (int)data["levelUpMoney"];
            json.attributeType     = (int)data["attributeType"];
            json.releaseEffect     = (int)data["releaseEffect"];
            json.skillId           = (int)data["skillId"];
            json.throwEffectId     = (int)data["throwEffectId"];
            json.distanceType      = (int)data["distanceType"];
            json.releaseCD         = (int)data["releaseCD"];
            json.expendPower       = (int)data["expendPower"];
            json.itemRequired      = (int)data["itemRequired"];
            json.levelRequired     = (int)data["levelRequired"];
            json.profession        = (int)data["profession"];
            json.bearEffect        = (int)data["bearEffect"];
            json.effect            = (int)data["effect"];
            json.expendHp          = (int)data["expendHp"];
            json.skillGroup        = (int)data["skillGroup"];
            json.icon              = (int)data["icon"];
            json.targetType        = (int)data["targetType"];
            json.itemCountRequired = (int)data["itemCountRequired"];
            json.skillDescript     = (string)data["skillDescript"];
            json.level             = (int)data["level"];
            json.type              = (int)data["type"];
            json.skillType         = (int)data["skillType"];
            json.aoeEffectId       = (int)data["aoeEffectId"];
        }
        catch {
        }
        return(json);
    }