Example #1
0
        private void UpdateDataAfterEmployGeneral(recvEmployGeneral pkg)
        {
            // 删除酒馆中的将魂
            entityUserSoul soul = pkg.userData.userSoul;
            bool bDone = false;
            bDone = DeleteSoul(ref root.userData.userTavern.id_1, soul, bDone);
            bDone = DeleteSoul(ref root.userData.userTavern.id_2, soul, bDone);
            bDone = DeleteSoul(ref root.userData.userTavern.id_3, soul, bDone);

            // 更新将魂列表
            bool bFound = false;
            foreach (entityUserSoul sl in root.userData.userSoul)
            {
                if (sl.generalType == soul.generalType)
                {
                    sl.number += soul.number;
                    bFound = true;
                }
            }
            if (!bFound)
            {
                root.userData.userSoul.Add(soul);
            }

            // 更新基础信息
            RefreshBase((recvPkgBase)pkg);
        }
Example #2
0
        public void ParseEmployGeneral(byte[] bs_result)
        {
            upCall.Print("ParseEmployGeneral", bs_result);
            Dictionary<string, object> dic_root = upCall.GetRootDic(bs_result);
            if (CheckForException(dic_root))
            {
                return;
            }

            recvEmployGeneral pkg = new recvEmployGeneral();
            upCall.SetSingleObject(dic_root, null, pkg);

            if (!dic_root.ContainsKey("userData"))
            {
                upCall.DebugLog("dic_root不存在userData键值");
                return;
            }
            Dictionary<string, object> dic_userData = (Dictionary<string, object>) dic_root["userData"];
            upCall.SetSingleObject(dic_userData, "userSoul", pkg.userData.userSoul);

            // 同步酒馆数据
            UpdateDataAfterEmployGeneral(pkg);

            // 更新UI显示
            this.nEplGenReqCnt--;
            if (this.nEplGenReqCnt == 0)
            {
                upCall.UIUpdateEmployGeneral();
            }
        }