Exemplo n.º 1
0
        public void onReqAvatarList(Dictionary <string, object> infos)
        {
            avatars.Clear();

            List <object> listinfos = (List <object>)infos["values"];

            Dbg.DEBUG_MSG("Account::onReqAvatarList: avatarsize=" + listinfos.Count);
            for (int i = 0; i < listinfos.Count; i++)
            {
                Dictionary <string, object> info = (Dictionary <string, object>)listinfos[i];
                Dbg.DEBUG_MSG("Account::onReqAvatarList: name" + i + "=" + (string)info["name"]);
                avatars.Add((UInt64)info["dbid"], info);
            }

            // ui event
            Dictionary <UInt64, Dictionary <string, object> > avatarList = new Dictionary <ulong, Dictionary <string, object> >(avatars);
            KBS_AvatarList e = new KBS_AvatarList();

            e.avatarList = avatarList;
            KBEvent.fireOut(KET.onReqAvatarList, e);

            if (listinfos.Count == 0)
            {
                return;
            }

            // selectAvatarGame(avatars.Keys.ToList()[0]);
        }
Exemplo n.º 2
0
        public void onRemoveAvatar(UInt64 dbid)
        {
            Dbg.DEBUG_MSG("Account::onRemoveAvatar: dbid=" + dbid);

            avatars.Remove(dbid);

            // ui event
            KBS_RemoveAvatarResp e = new KBS_RemoveAvatarResp();

            e.dbid       = dbid;
            e.avatarList = avatars;
            KBEvent.fireOut(KET.onRemoveAvatar, e);
        }
Exemplo n.º 3
0
        public override void __init__()
        {
            // 注册事件
            KBEvent.registerIn(KET.reqCreateAvatar, this, reqCreateAvatar);
            KBEvent.registerIn(KET.reqRemoveAvatar, this, reqRemoveAvatar);
            KBEvent.registerIn(KET.selectAvatarGame, this, selectAvatarGame);

            // 触发登陆成功事件
            KBS_LoginSuccess e = new KBS_LoginSuccess();

            e.rndUUID       = KBEngineApp.app.entity_uuid;
            e.eid           = id;
            e.accountEntity = this;
            KBEvent.fireOut(KET.onLoginSuccessfully, e);

            // 向服务端请求获得角色列表
            baseCall("reqAvatarList");
        }
Exemplo n.º 4
0
        public void onCreateAvatarResult(Byte retcode, object info)
        {
            if (retcode == 0)
            {
                avatars.Add((UInt64)((Dictionary <string, object>)info)["dbid"], (Dictionary <string, object>)info);
                Dbg.DEBUG_MSG("Account::onCreateAvatarResult: name=" + (string)((Dictionary <string, object>)info)["name"]);
            }
            else
            {
                Dbg.ERROR_MSG("Account::onCreateAvatarResult: retcode=" + retcode);
            }

            // ui event
            KBS_CreateAvatarResult e = new KBS_CreateAvatarResult();

            e.retcode    = retcode;
            e.info       = info;
            e.avatarList = avatars;
            KBEvent.fireOut(KET.onCreateAvatarResult, e);
        }