Esempio n. 1
0
 public CMiniFightingData()
 {
     this.isoTime    = string.Empty;
     this.playerData = null;
     this.enemyData  = null;
     this.randomSeed = 999;
 }
        // HANDLE LOAD CHARACTER
        protected virtual IEnumerator HandleSpawnCharacter(CHeroData charData, GameObject spawnPoint, Action <CHeroController> completed)
        {
            var charCtrl = Instantiate(Resources.Load <CHeroController>("CharacterPrefabs/" + charData.objectModel));

            yield return(charCtrl);

            // INIT DATA
            charCtrl.SetData(charData);
            charCtrl.SetActive(true);
            charCtrl.Init();
            // EVENTS
            charCtrl.AddAction("StartInactiveState", this.OnCharacterInactive);
            // SET CURRENT BLOCK
            charCtrl.SetPosition(spawnPoint.transform.position);
            // COMPLETED
            if (completed != null)
            {
                completed(charCtrl);
            }
            // EVENT
            if (this.m_PlayerController != null && this.m_EnemyController != null)
            {
                if (this.OnLoadMiniGameCompleted != null)
                {
                    this.OnLoadMiniGameCompleted();
                }
                this.m_BattleEnd = false;
            }
        }
Esempio n. 3
0
        public virtual void OnClientSetupLobbyScene(JSONObject receiveData)
        {
            // HERO DATA
            var isHeroData = receiveData.HasField("heroData");

            this.currentHero = CTaskUtil.Get(CTaskUtil.HERO_DATA) as CHeroData;
            if (isHeroData)
            {
                var heroDataJson = receiveData.GetField("heroData").ToString();
                this.currentHero = TinyJSON.JSON.Load(heroDataJson).Make <CHeroData> ();
            }
            CTaskUtil.Set(CTaskUtil.HERO_DATA, this.currentHero);
            // SKILL DATA
            var isSkillData = receiveData.HasField("skillDatas");

            if (isSkillData)
            {
                var skillList    = receiveData.GetField("skillDatas").list;
                var tmpSkillList = new List <CSkillData>();
                for (int i = 0; i < skillList.Count; i++)
                {
                    var objectStr = skillList [i].ToString();
                    var skillData = TinyJSON.JSON.Load(objectStr).Make <CSkillData> ();
                    tmpSkillList.Add(skillData);
                }
                CTaskUtil.Set(CTaskUtil.SKILL_DATA_LIST, tmpSkillList);
            }
        }
Esempio n. 4
0
        protected virtual void OnClientSetupPlayScene(JSONObject receiveData)
        {
            // HERO DATA
            var isHeroData = receiveData.HasField("heroData");

            this.currentHero = CTaskUtil.Get(CTaskUtil.HERO_DATA) as CHeroData;
            if (isHeroData)
            {
                var heroDataJson = receiveData.GetField("heroData").ToString();
                this.currentHero = TinyJSON.JSON.Load(heroDataJson).Make <CHeroData> ();
            }
            CTaskUtil.Set(CTaskUtil.HERO_DATA, this.currentHero);
        }
Esempio n. 5
0
        protected virtual void OnClientSetupCreateHeroScene(JSONObject receiveData)
        {
            // HERO DATA
            var isHeroData = receiveData.HasField("heroData");

            this.currentHero = CTaskUtil.Get(CTaskUtil.HERO_DATA) as CHeroData;
            if (isHeroData)
            {
                var heroDataJson = receiveData.GetField("heroData").ToString();
                this.currentHero = TinyJSON.JSON.Load(heroDataJson).Make <CHeroData> ();
            }
            CTaskUtil.Set(CTaskUtil.HERO_DATA, this.currentHero);
            // HEROES TEMPLATE
            var isHeroTemplate = receiveData.HasField("heroesTemplate");
            Dictionary <string, CCharacterData> heroesTemplate = CTaskUtil.Get(CTaskUtil.HERO_TEMPLATES) as Dictionary <string, CCharacterData>;

            if (isHeroTemplate)
            {
                var heroTemplateJson = receiveData.GetField("heroesTemplate").ToString();
                heroesTemplate = TinyJSON.JSON.Load(heroTemplateJson).Make <Dictionary <string, CCharacterData> > ();
            }
            CTaskUtil.Set(CTaskUtil.HERO_TEMPLATES, heroesTemplate);
        }
Esempio n. 6
0
 public override void SetData(CObjectData value)
 {
     base.SetData(value);
     this.m_HeroData = value as CHeroData;
 }