Example #1
0
        //--------------------------------------------------------
        // 内部调用
        //--------------------------------------------------------

        /// <summary>
        /// 根据获取的服务器信息来进行登陆
        /// </summary>
        void LoginServer(string url)
        {
            // 登陆服务器
            string[] ips  = url.Split(':');
            Game     game = Game.GetInstance();

            game.ServerIP   = ips[0];
            game.ServerPort = DBTextResource.ParseI(ips[1]);
            game.ServerID   = 1;

            game.GameMode = (Game.EGameMode)((int)game.GameMode | (int)xc.Game.EGameMode.GM_Net);
            game.Login();
        }
Example #2
0
    protected override void ParseData(SqliteDataReader reader)
    {
        if (reader == null || !reader.HasRows)
        {
            return;
        }

        BulletInfo kInfo;

        while (reader.Read())
        {
            kInfo            = new BulletInfo();
            kInfo.ID         = DBTextResource.ParseUI(GetReaderString(reader, "type_idx"));
            kInfo.BulletType = (BulletTypes)DBTextResource.ParseUI_s(GetReaderString(reader, "bullet_type"), 0);
            kInfo.FlySpeed   = (float)DBTextResource.ParseI(GetReaderString(reader, "speed")) * 0.01f;
            kInfo.FlyMaxTime = (float)DBTextResource.ParseI(GetReaderString(reader, "max_time")) * 0.001f;
            kInfo.OffsetX    = DBTextResource.ParseI(GetReaderString(reader, "offset_x")) * 0.01f;
            kInfo.OffsetY    = DBTextResource.ParseI(GetReaderString(reader, "offset_y")) * 0.01f;

            string effect_file = GetReaderString(reader, "effect_file");
            if (!string.IsNullOrEmpty(effect_file))
            {
                kInfo.AttackEffect = effect_file + ".prefab";
            }
            string sound_file = GetReaderString(reader, "sound_file").Trim();
            if (!string.IsNullOrEmpty(sound_file))
            {
                kInfo.AttackSound = sound_file + ".mp3";
            }

            /*string under_attack_effect = GetReaderString(reader,"under_attack_effect");
             * if (under_attack_effect != string.Empty)
             *  under_attack_effect = under_attack_effect + ".prefab";
             * string under_attack_sound = GetReaderString(reader,"under_attack_sound");
             * if (under_attack_sound != string.Empty)
             *  under_attack_sound = string.Format("{{0}.mp3", under_attack_sound);
             *
             * if (!string.IsNullOrEmpty(under_attack_effect) || !string.IsNullOrEmpty(under_attack_sound))
             * {
             *  kInfo.BeattackEffectData = new AnimationEffect.ResInitData();
             *  kInfo.BeattackEffectData.Prefab = under_attack_effect;
             *  kInfo.BeattackEffectData.Audio = under_attack_sound;
             *  kInfo.BeattackEffectData.EndTime = (float)DBTextResource.ParseF_s(GetReaderString(reader,"under_attack_lifetime"), 0) * 0.001f;
             *  kInfo.BeattackEffectData.InWorld = true;
             * }*/

            mBulletInfos.Add(kInfo.ID, kInfo);
        }
    }
Example #3
0
        public void InitAllMapPoint()
        {
            List <Dictionary <string, string> > data_world = DBManager.Instance.QuerySqliteTable <string>(GlobalConfig.DBFile, "data_world");

            for (int i = 0; i < data_world.Count; i++)
            {
                Dictionary <string, string> data = data_world[i];
                int    mapId        = DBTextResource.ParseI(data["map_id"]);
                string mapPointName = data["map_point_name"];
                var    go           = Window.FindChild(mapPointName);
                if (go != null)
                {
                    var    instanceInfo = DBInstance.Instance.GetInstanceInfo((uint)mapId);
                    Button btn          = go.transform.Find("BgImage").GetComponent <Button>();
                    if (instanceInfo != null)
                    {
                        btn.onClick.RemoveAllListeners();
                        btn.onClick.AddListener(() => { OnClickMap((uint)mapId); });

                        mMapGoDic.Add(mapId, go);
                    }
                    else
                    {
                        var bgImage = go.GetComponent <Image>();
                        SetMapPointImgState(bgImage, true);

                        btn.gameObject.SetActive(false);

                        var lockObj = go.transform.Find("Lock");
                        lockObj.gameObject.SetActive(false);
                    }
                }
            }

            SetMapIconState(true);
        }
Example #4
0
    private void OnCSLoginFinished(string url, string error, string reply, System.Object userData)
    {
        //GameDebug.LogError("OnCSLoginFinished url: " + url);
        if (String.IsNullOrEmpty(error) == false)
        {
            GameDebug.LogError("OnCSLoginFinished error: " + error);
            if (String.IsNullOrEmpty(error))
            {
                error = xc.TextHelper.SDKLogingFail + "(" + error + ")";
            }
            endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, error);
            return;
        }
        GameDebug.Log("CS Login succeed, msg = " + reply);
        Hashtable hashtable = MiniJSON.JsonDecode(reply) as Hashtable;

        if (hashtable != null)
        {
            int       errorCode = 0;
            Hashtable retArgs   = hashtable["args"] as Hashtable;
            if (hashtable["result"] != null)
            {
                errorCode = DBTextResource.ParseI(hashtable["result"].ToString());
            }
            if (errorCode != 1)
            {
                string msg = "CS login error";
                if (retArgs["error_msg"] != null)
                {
                    msg = retArgs["error_msg"] as string;
                }
                endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, msg);
                return;
            }
            string passport = "";
            if (retArgs["passport"] != null)
            {
                passport = "" + DBTextResource.ParseI(retArgs["passport"].ToString());//(hashtable["passport"] as int) + "";
                //数据发送给 talking data
                //DBOSManager.getOSBridge().onTDLogin(passport);
            }
            string providerPassport = "";
            if (retArgs["provider_passport"] != null)
            {
                providerPassport = retArgs["provider_passport"] as string;
            }
            string ticket = "";
            if (retArgs["ticket"] != null)
            {
                ticket = retArgs["ticket"] as string;
            }
            string errorMsg = "";
            if (retArgs["error_msg"] != null)
            {
                errorMsg = retArgs["error_msg"] as string;
            }


            GlobalConfig globalConfig = GlobalConfig.GetInstance();

            if (retArgs["status"] != null)  // 是否需要输入激活码
            {
                globalConfig.LoginInfo.Status = retArgs["status"].ToString();
            }
            if (retArgs["roll_server"] != null)  // 滚服次数
            {
                globalConfig.LoginInfo.RollServer = DBTextResource.ParseUI(retArgs["roll_server"].ToString());
            }
            if (errorCode == 1 && passport != null && ticket != null)
            {
                GameDebug.Log("Get status success, sdkname:" + globalConfig.SDKName + ", passport:" + passport + ", ticket:" + ticket + ", errorMsg:" + errorMsg
                              + ", errorCode:" + errorCode);

                globalConfig.LoginInfo.AccName          = passport;
                globalConfig.LoginInfo.ProviderPassport = providerPassport;
                globalConfig.LoginInfo.Ticket           = ticket;
                //添加初始化话绑定手机逻辑

                int bindMobileState  = -1;
                int bindMobileSwitch = 0;
                if (retArgs["bindMobileSwitch"] != null)
                {
                    bindMobileSwitch = DBTextResource.ParseI(retArgs["bindMobileSwitch"].ToString());
                    if (bindMobileSwitch == 1)
                    {
                        bindMobileState = 0;
                        int isBindMobile = 0;
                        if (retArgs["isBindMobile"] != null)
                        {
                            isBindMobile = DBTextResource.ParseI(retArgs["isBindMobile"].ToString());
                            if (isBindMobile == 1)
                            {
                                bindMobileState = 1;
                            }
                        }
                    }
                }

                GlobalConfig.Instance.BindMobileState = bindMobileState;
                OnSDKLoginSucceed(passport, ticket);

                // 首次登录_37wan渠道
                var first37WanUjoy = PlayerPrefs.GetInt(BuriedPointConst.first37WanUjoy, 0);
                if (first37WanUjoy == 0)
                {
                    PlayerPrefs.SetInt(BuriedPointConst.first37WanUjoy, 1);
                    PlayerPrefs.Save();
                    BuriedPointHelper.ReportEsaAppsflyerEvnet("custom_loss", "finishlogin_new_37wan_ujoy_firsttime", 1);
                }
            }
            else
            {
                endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, errorMsg);
            }
        }
        else
        {
            endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, reply);
        }
    }