Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        public virtual void OnClientReceiveResultPlayerQueue(SocketIOEvent obj)
        {
            Debug.LogWarning(obj.ToString());
            var responseData     = obj.data;
            var miniFightingData = TinyJSON.JSON.Load(responseData.ToString()).Make <CMiniFightingData> ();

            CTaskUtil.Set(CTaskUtil.MINI_FIGHTING_TEXT, responseData.ToString());
            CTaskUtil.Set(CTaskUtil.MINI_FIGHTING_DATA, miniFightingData);
            // COMPLETE TASK
            this.m_NextTask = "MiniGameFightingScene";
            this.OnTaskCompleted();
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public virtual void OnClientRegisterCompleted(CUserData user)
 {
     if (this.OnEventRegisterCompleted != null)
     {
         this.OnEventRegisterCompleted(user);
     }
     // TRY CONNECT TO SERVER
     this.OnClientConnectServer();
     // SAVE USER DATA
     CTaskUtil.Set(CTaskUtil.USER_DATA, user);
     // LOGGED IN
     this.m_LogedIn = true;
 }
Exemplo n.º 5
0
 public virtual void OnClientLoginCompleted(CUserData user)
 {
     Debug.LogWarning("OnClientLoginCompleted USER " + user.userName + " PASSWORD " + user.userPassword);
     if (this.OnEventLoginCompleted != null)
     {
         this.OnEventLoginCompleted(user);
     }
     // TRY CONNECT TO SERVER
     this.OnClientConnectServer();
     // SAVE USER DATA
     CTaskUtil.Set(CTaskUtil.USER_DATA, user);
     // LOGGED IN
     this.m_LogedIn = true;
     PlayerPrefs.SetString(CTaskUtil.USER_STATE, "LOGGED_IN");
 }
Exemplo n.º 6
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);
        }