Ejemplo n.º 1
0
        void downloadSDKFromServer()
        {
            downloadFiles = 0;

            if (Directory.Exists(sdkTempPath))
            {
                Directory.Delete(sdkTempPath, true);
            }

            Directory.CreateDirectory(sdkTempPath);

            if (sdkFileStream != null)
            {
                sdkFileStream.reclaimObject();
                sdkFileStream = null;
            }

            // kbcmd options
            string tool_options     = "Unity";
            string callbackIP       = "";
            UInt16 callbackPort     = 0;
            int    clientWindowSize = (int)KBEngineApp.app.getInitArgs().RECV_BUFFER_MAX;

            Bundle bundle = Bundle.createObject();

            bundle.newMessage(Messages.messages["Loginapp_importClientSDK"]);
            bundle.writeString(tool_options);
            bundle.writeInt32(clientWindowSize);
            bundle.writeString(callbackIP);
            bundle.writeUint16(callbackPort);
            bundle.send(KBEngineApp.app.networkInterface());
        }
Ejemplo n.º 2
0
 public void addToStreamEx(Bundle stream, D_PROPS_INFOS v)
 {
     stream.writeInt32(v.prop_id);
     stream.writeUnicode(v.prop_name);
     stream.writeString(v.prop_icon);
     stream.writeInt32(v.prop_type);
     stream.writeInt32(v.prop_quality);
     stream.writeInt32(v.prop_order);
     stream.writeInt32(v.prop_max);
     stream.writeInt32(v.prop_resale);
     stream.writeInt32(v.prop_diamond);
     stream.writeInt32(v.prop_hanbing);
     stream.writeInt32(v.prop_moba);
     stream.writeInt32(v.prop_jjc);
     stream.writeInt32(v.prop_maoxian);
     stream.writeUnicode(v.prop_describe);
     stream.writeInt32(v.prop_function);
     stream.writeInt32(v.prop_parameters1);
     stream.writeInt32(v.prop_parameters2);
     stream.writeInt32(v.prop_parameters3);
     stream.writeInt32(v.prop_parameters4);
     stream.writeInt32(v.prop_parameters5);
     stream.writeInt32(v.prop_parameters6);
     stream.writeInt32(v.prop_drop1);
     stream.writeInt32(v.prop_drop2);
     stream.writeInt32(v.prop_drop3);
     stream.writeInt32(v.prop_drop4);
     stream.writeInt32(v.prop_gm);
     stream.writeInt32(v.prop_buy);
 }
Ejemplo n.º 3
0
 public void addToStreamEx(Bundle stream, D_HERO_INFOS v)
 {
     stream.writeInt32(v.id);
     stream.writeString(v.name);
     stream.writeUnicode(v.nick_name);
     stream.writeInt32(v.race);
     stream.writeUnicode(v.race_desc);
     stream.writeInt32(v.skill_1);
     stream.writeInt32(v.skill_2);
     stream.writeInt32(v.skill_3);
     stream.writeInt32(v.skill_4);
     stream.writeInt32(v.hero_hp);
     stream.writeInt32(v.hero_mp);
     stream.writeInt32(v.hero_strength);
     stream.writeInt32(v.hero_agile);
     stream.writeInt32(v.hero_intelligence);
     stream.writeInt32(v.hero_attacktime);
     stream.writeInt32(v.hero_speed);
     stream.writeInt32(v.hero_attackfront);
     stream.writeInt32(v.hero_attackback);
     stream.writeInt32(v.hero_skillfront);
     stream.writeInt32(v.hero_skillback);
     stream.writeInt32(v.hero_scope);
     stream.writeInt32(v.hero_attack);
     stream.writeInt32(v.hero_armor);
     stream.writeInt32(v.hero_unarmor);
     stream.writeInt32(v.hero_magic);
     stream.writeInt32(v.hero_magicresist);
     stream.writeInt32(v.hero_hprestored);
     stream.writeInt32(v.hero_mprestored);
     stream.writeInt32(v.hero_crit);
     stream.writeInt32(v.hero_uncrit);
     stream.writeInt32(v.hero_critunmber);
     stream.writeInt32(v.hero_evade);
     stream.writeInt32(v.hero_unevade);
     stream.writeInt32(v.hero_parry);
     stream.writeInt32(v.hero_unparry);
     stream.writeInt32(v.hero_parrynumber);
     stream.writeInt32(v.hero_xixue);
     stream.writeInt32(v.atk_power);
     stream.writeInt32(v.hurt_power);
     stream.writeInt32(v.kill_power);
     stream.writeInt32(v.hero_energe);
     stream.writeString(v.head_icon);
 }
Ejemplo n.º 4
0
 public void addToStreamEx(Bundle stream, D_SHOP_INFOS v)
 {
     stream.writeInt32(v.shop_id);
     stream.writeUnicode(v.shop_des);
     stream.writeInt32(v.shop_refreshstart);
     stream.writeInt32(v.shop_refreshtime);
     stream.writeInt32(v.shop_needid);
     stream.writeUnicode(v.shop_needdes);
     stream.writeInt32(v.shop_amount);
     stream.writeString(v.shop_refreshtime1);
     stream.writeInt32(v.open_lv);
 }
Ejemplo n.º 5
0
 public void addToStreamEx(Bundle stream, D_SKILL_INFOS v)
 {
     stream.writeInt32(v.id);
     stream.writeUnicode(v.name);
     stream.writeString(v.skill_icon);
     stream.writeInt32(v.skill_damage_chushi);
     stream.writeInt32(v.skill_damage_growth);
     stream.writeInt32(v.skill_ad_chushi);
     stream.writeInt32(v.skill_ad_growth);
     stream.writeInt32(v.skill_ap_chushi);
     stream.writeInt32(v.skill_ap_growth);
     stream.writeInt32(v.skill_type);
     stream.writeInt32(v.skill_ongoing);
     stream.writeInt32(v.skill_sing_time);
     stream.writeInt32(v.skill_cutdown);
     stream.writeInt32(v.skill_cutdownif);
     stream.writeInt32(v.skill_cd);
     stream.writeInt32(v.attack_distance);
     stream.writeInt32(v.aoe_radius);
 }
Ejemplo n.º 6
0
        private void onReConnectTo_baseapp_callback(string ip, int port, bool success, object userData)
        {
            if(!success)
            {
                Dbg.ERROR_MSG(string.Format("KBEngine::reLoginBaseapp(): connect {0}:{1} is error!", ip, port));
                return;
            }

            Dbg.DEBUG_MSG(string.Format("KBEngine::relogin_baseapp(): connect {0}:{1} is successfully!", ip, port));

            Bundle bundle = new Bundle();
            bundle.newMessage(Message.messages["Baseapp_reLoginBaseapp"]);
            bundle.writeString(username);
            bundle.writeString(password);
            bundle.writeUint64(entity_uuid);
            bundle.writeInt32(entity_id);
            bundle.send(_networkInterface);
        }
Ejemplo n.º 7
0
 /*
     重置密码, 通过loginapp
 */
 public void resetpassword_loginapp(bool noconnect)
 {
     if(noconnect)
     {
         reset();
         _networkInterface.connectTo(_args.ip, _args.port, onConnectTo_resetpassword_callback, null);
     }
     else
     {
         Bundle bundle = new Bundle();
         bundle.newMessage(Message.messages["Loginapp_reqAccountResetPassword"]);
         bundle.writeString(username);
         bundle.send(_networkInterface);
     }
 }
Ejemplo n.º 8
0
 /*
     绑定Email,通过baseapp
 */
 public void bindAccountEmail(string emailAddress)
 {
     Bundle bundle = new Bundle();
     bundle.newMessage(Message.messages["Baseapp_reqAccountBindEmail"]);
     bundle.writeInt32(entity_id);
     bundle.writeString(password);
     bundle.writeString(emailAddress);
     bundle.send(_networkInterface);
 }
Ejemplo n.º 9
0
 /*
     设置新密码,通过baseapp, 必须玩家登录在线操作所以是baseapp。
 */
 public void newPassword(string old_password, string new_password)
 {
     Bundle bundle = new Bundle();
     bundle.newMessage(Message.messages["Baseapp_reqAccountNewPassword"]);
     bundle.writeInt32(entity_id);
     bundle.writeString(old_password);
     bundle.writeString(new_password);
     bundle.send(_networkInterface);
 }
Ejemplo n.º 10
0
 /*
     登录到服务端(loginapp), 登录成功后还必须登录到网关(baseapp)登录流程才算完毕
 */
 public void login_loginapp(bool noconnect)
 {
     if(noconnect)
     {
         reset();
         _networkInterface.connectTo(_args.ip, _args.port, onConnectTo_loginapp_callback, null);
     }
     else
     {
         Dbg.DEBUG_MSG("KBEngine::login_loginapp(): send login! username="******"Loginapp_login"]);
         bundle.writeInt8((sbyte)_args.clientType);
         bundle.writeBlob(KBEngineApp.app._clientdatas);
         bundle.writeString(username);
         bundle.writeString(password);
         bundle.send(_networkInterface);
     }
 }
Ejemplo n.º 11
0
        /*
            登录到服务端,登录到网关(baseapp)
        */
        public void login_baseapp(bool noconnect)
        {
            if(noconnect)
            {
                Event.fireOut("onLoginBaseapp", new object[]{});

                _networkInterface.reset();
                _networkInterface = new NetworkInterface();
                _networkInterface.connectTo(baseappIP, baseappPort, onConnectTo_baseapp_callback, null);
            }
            else
            {
                Bundle bundle = new Bundle();
                bundle.newMessage(Message.messages["Baseapp_loginBaseapp"]);
                bundle.writeString(username);
                bundle.writeString(password);
                bundle.send(_networkInterface);
            }
        }
Ejemplo n.º 12
0
		public override void addToStream(Bundle stream, object v)
		{
			stream.writeString(Convert.ToString(v));
		}
Ejemplo n.º 13
0
 public void bindEMail_baseapp()
 {
     Bundle bundle = new Bundle();
     bundle.newMessage(Message.messages["Baseapp_reqAccountBindEmail"]);
     bundle.writeInt32(entity_id);
     bundle.writeString(password);
     bundle.writeString("*****@*****.**");
     bundle.send(networkInterface_);
 }
Ejemplo n.º 14
0
        public bool resetpassword_loginapp(bool noconnect)
        {
            if(noconnect)
            {
                reset();
                if(!networkInterface_.connect(ip, port))
                {
                    Dbg.ERROR_MSG(string.Format("KBEngine::resetpassword_loginapp(): connect {0}:{1} is error!", ip, port));
                    return false;
                }

                onOpenLoginapp_resetpassword();
                Dbg.DEBUG_MSG(string.Format("KBEngine::resetpassword_loginapp(): connect {0}:{1} is successfylly!", ip, port));
            }
            else
            {
                Bundle bundle = new Bundle();
                bundle.newMessage(Message.messages["Loginapp_reqAccountResetPassword"]);
                bundle.writeString(username);
                bundle.send(networkInterface_);
            }

            return true;
        }
Ejemplo n.º 15
0
        public bool login_loginapp(bool noconnect)
        {
            if(noconnect)
            {
                reset();
                if(!networkInterface_.connect(loginappIP, loginappPort))
                {
                    Dbg.ERROR_MSG(string.Format("KBEngine::login_loginapp(): connect {0}:{1} is error!", loginappIP, loginappPort));
                    return false;
                }

                onLogin_loginapp();
                Dbg.DEBUG_MSG(string.Format("KBEngine::login_loginapp(): connect {0}:{1} is successfylly!", loginappIP, loginappPort));
            }
            else
            {
                Dbg.DEBUG_MSG("KBEngine::login_loginapp(): send login! username="******"Loginapp_login"]);
                bundle.writeInt8(3); // clientType
                bundle.writeBlob(new byte[0]);
                bundle.writeString(username);
                bundle.writeString(password);
                bundle.send(networkInterface_);
            }

            return true;
        }
Ejemplo n.º 16
0
        public bool login_baseapp(bool noconnect)
        {
            if(noconnect)
            {
                Event.fire("login_baseapp", new object[]{});
                if(!networkInterface_.connect(ip, port))
                {
                    Dbg.ERROR_MSG(string.Format("KBEngine::login_baseapp(): connect {0}:{1} is error!", ip, port));
                    return false;
                }

                onLogin_baseapp();
                Dbg.DEBUG_MSG(string.Format("KBEngine::login_baseapp(): connect {0}:{1} is successfylly!", ip, port));
            }
            else
            {
                Bundle bundle = new Bundle();
                bundle.newMessage(Message.messages["Baseapp_loginGateway"]);
                bundle.writeString(username);
                bundle.writeString(password);
                bundle.send(networkInterface_);
            }

            return true;
        }
Ejemplo n.º 17
0
 public void hello()
 {
     Bundle bundle = new Bundle();
     if(currserver_ == "loginapp")
         bundle.newMessage(Message.messages["Loginapp_hello"]);
     else
         bundle.newMessage(Message.messages["Baseapp_hello"]);
     bundle.writeString(clientVersion_);
     bundle.writeBlob(clientdatas_);
     bundle.send(networkInterface_);
 }
Ejemplo n.º 18
0
 public override void addToStream(Bundle stream, object v)
 {
     stream.writeString(Convert.ToString(v));
 }
Ejemplo n.º 19
0
 /*
     创建账号,通过loginapp
 */
 public void createAccount_loginapp(bool noconnect)
 {
     if(noconnect)
     {
         reset();
         _networkInterface.connectTo(_args.ip, _args.port, onConnectTo_createAccount_callback, null);
     }
     else
     {
         Bundle bundle = new Bundle();
         bundle.newMessage(Message.messages["Loginapp_reqCreateAccount"]);
         bundle.writeString(username);
         bundle.writeString(password);
         bundle.writeBlob(KBEngineApp.app._clientdatas);
         bundle.send(_networkInterface);
     }
 }
Ejemplo n.º 20
0
        /*
            与服务端握手,与任何一个进程连接之后应该第一时间进行握手
        */
        public void hello()
        {
            Bundle bundle = new Bundle();
            if(currserver == "loginapp")
                bundle.newMessage(Message.messages["Loginapp_hello"]);
            else
                bundle.newMessage(Message.messages["Baseapp_hello"]);

            bundle.writeString(clientVersion);
            bundle.writeString(clientScriptVersion);
            bundle.writeBlob(_encryptedKey);
            bundle.send(_networkInterface);
        }