Ejemplo n.º 1
0
        public FriendsInfo CreateSelfFriendInfo()
        {
            uint   uuid       = LocalPlayerManager.Instance.LocalActorAttribute.UnitId.obj_idx;
            string name       = LocalPlayerManager.Instance.LocalActorAttribute.Name;
            uint   level      = LocalPlayerManager.Instance.LocalActorAttribute.Level;
            uint   roleID     = LocalPlayerManager.Instance.LocalActorAttribute.Vocation;
            uint   transferLV = LocalPlayerManager.Instance.LocalActorAttribute.TransferLv;
            uint   VIPLV      = VipHelper.GetVipValidLevel();

            FriendsInfo SelfInfo = new FriendsInfo(uuid, name, level, roleID, true, 0, 0, transferLV, VIPLV);

            return(SelfInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 角色日志接口
        /// </summary>
        public void PostRoleInfo()
        {
            GlobalConfig globalConfig = GlobalConfig.GetInstance();

            GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo;
            IBridge bridge = DBOSManager.getDBOSManager().getBridge();

            if (loginInfo == null || loginInfo.ServerInfo == null)
            {
                return;
            }

            string url = GlobalConfig.GetInstance().LogURLV + "RoleInfo";

            url += "?account=" + loginInfo.AccName;
            url += "&provider=" + globalConfig.SDKName;
            url += "&device_mark=" + globalConfig.DeviceMark;
            url += "&server_id=" + loginInfo.ServerInfo.ServerId;
            url += "&os=" + globalConfig.PlatformName;
            url += "&level=" + loginInfo.Level;
            url += "&role_id=" + loginInfo.RId;
            url += "&role_name=" + WWW.EscapeURL(loginInfo.Name);
            url += "&icon_id=" + loginInfo.Job;
            url += "&job=" + loginInfo.Job;
            url += "&game_mark=" + globalConfig.GameMark;
            url += "&mobile=" + bridge.getPhoneModel();
            url += "&net=" + bridge.getNetType();
            url += "&ticket=" + WWW.EscapeURL(loginInfo.Ticket);
            // 获取不到IMEI(例如玩家不给权限),就用玩家唯一id代替
            string imei = bridge.getPhoneIMEI();

            if (string.IsNullOrEmpty(imei) == false)
            {
                url += "&imei=" + imei;
            }
            else
            {
                url += "&imei=" + loginInfo.RId;
            }
            url += "&roleInfo=" + "transfer_lv:" + TransferHelper.GetTransferLevel();   // 自定义角色数据,例:roleInfo=tran_lv:213#icon_id:3#gander:man
            url += "&xg_device_id=" + globalConfig.XgDeviceId;
            url += "&vip=" + VipHelper.GetVipValidLevel();
            url += "&app_id=" + globalConfig.AppId;
            url += "&access_id=" + bridge.getXgAccessId();

            MainGame.HttpRequest.GET(url, OnPostRoleInfoFinished, null);
        }
Ejemplo n.º 3
0
        public override void SetVipIcon(uint vipLv)
        {
            string icon_name = VipHelper.GetVipIconName(vipLv);
            Sprite icon      = mSpriteList.LoadSprite(icon_name);

            if (null != icon)
            {
                mSenderVipIcon.gameObject.SetActive(true);

                mSenderVipIcon.sprite = icon;
                mSenderVipIcon.SetNativeSize();
            }
            else
            {
                mSenderVipIcon.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 飞鞋
        /// </summary>
        public static bool TravelBootsJump(Vector3 pos, uint instanceId = 0, bool isFree = false, uint line = 1, bool isAutoFighting = false)
        {
            if (instanceId == 0)
            {
                instanceId = SceneHelp.Instance.CurSceneID;
            }

            if (PKModeManagerEx.Instance.TryToOtherDungeonScene() == false)
            {
                return(false);
            }

            DBInstance.InstanceInfo instanceInfo = DBInstance.Instance.GetInstanceInfo(instanceId);
            if (instanceInfo == null)
            {
                GameDebug.LogError("Travel boots ump to scene " + instanceId + " error, can not find instance info!!!");
                return(false);
            }

            // 本地玩家处于护送状态不能用飞鞋
            if (CheckLocalPlayerEscortTaskState() == false)
            {
                return(false);
            }

            // 检查道具
            if (isFree == false)
            {
                if (VipHelper.GetIsFlyFree() == false)
                {
                    uint need_goods = GameConstHelper.GetUint("GAME_ITEM_TRAVEL_BOOTS");
                    if (need_goods > 0)
                    {
                        var num = ItemManager.Instance.GetGoodsNumForBagByTypeId(need_goods);
                        if (num <= 0)
                        {
                            UINotice.Instance.ShowMessage(DBConstText.GetText("ITME_NUM_NOTENOUGH"));
                            return(false);
                        }
                    }
                }
            }

            bool isInstance = false;

            if (instanceInfo.mWarType == GameConst.WAR_TYPE_DUNGEON)
            {
                isInstance = true;
            }

            // 检查是否达到等级
            uint needLv = InstanceHelper.GetInstanceNeedRoleLevel(instanceId);

            if (LocalPlayerManager.Instance.LocalActorAttribute.Level < needLv)
            {
                // 巅峰等级
                uint   peakLv   = 0;
                bool   isPeak   = TransferHelper.IsPeak(needLv, out peakLv);
                string levelStr = "";
                if (isPeak)
                {
                    levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0}
                }
                else
                {
                    levelStr = peakLv.ToString(); // {0}
                }
                if (isInstance == true)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr));
                }
                else
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_LEVEL"), levelStr));
                }
                return(false);
            }

            // 检查是否通关某主线任务
            uint needTaskId = instanceInfo.mNeedTaskId;

            if (needTaskId > 0)
            {
                if (TaskHelper.MainTaskIsPassed(needTaskId) == false)
                {
                    TaskDefine needTaskDefine = TaskDefine.MakeDefine(needTaskId);
                    if (needTaskDefine != null)
                    {
                        // 巅峰等级
                        uint   peakLv   = 0;
                        bool   isPeak   = TransferHelper.IsPeak((uint)needTaskDefine.RequestLevelMin, out peakLv);
                        string levelStr = "";
                        if (isPeak)
                        {
                            levelStr = string.Format(DBConstText.GetText("UI_PLAYER_PEAK_LEVEL_FORMAT_2"), peakLv); // 巅峰{0}
                        }
                        else
                        {
                            levelStr = peakLv.ToString(); // {0}
                        }
                        if (isInstance == true)
                        {
                            UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName));
                        }
                        else
                        {
                            UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("WILD_INSTANCE_IS_NOT_UNLOCK_NEED_TASK"), levelStr, needTaskDefine.Name, instanceInfo.mName));
                        }
                    }
                    return(false);
                }
            }

            // 判断是否可到达
            if (instanceId == SceneHelp.Instance.CurSceneID)
            {
                if (InstanceHelper.CanWalkTo(pos) == false)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("MAP_POS_CAN_NOT_REACH"));
                    return(false);
                }
            }

            // 跳往不同的场景需要加个转圈,防止同时多次跳转
            if (instanceId != SceneHelp.Instance.CurSceneID)
            {
                ui.ugui.UIManager.GetInstance().ShowWaitScreen(true);
            }

            C2STravelBootsJump data = new C2STravelBootsJump();

            data.dungeon_id = instanceId;
            data.line       = line;
            PkgNwarPos pkgNwarPos = new PkgNwarPos();

            pkgNwarPos.px = (int)(pos.x / GlobalConst.UnitScale);
            pkgNwarPos.py = (int)(pos.z / GlobalConst.UnitScale);
            data.pos      = pkgNwarPos;
            if (isFree == true)
            {
                data.is_free = 1;
            }
            else
            {
                data.is_free = 0;
            }

            NetClient.BaseClient.SendData <C2STravelBootsJump>(NetMsg.MSG_TRAVEL_BOOTS_JUMP, data);

            SceneHelp.Instance.IsAutoFightingAfterSwitchInstance = isAutoFighting;

            InstanceManager.Instance.IsAutoFighting = false;

            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 玩家登录轨迹
        /// </summary>
        public void PostPlayerFollowRecord(PlayerFollowRecordSceneId sceneId, string desc = "", bool isEnterGame = true)
        {
            if (sceneId == PlayerFollowRecordSceneId.EnterFirstScene)
            {
                // TestinExternalLog
                DBOSManager.getOSBridge().log2OSCmd("TestinExternalLog", mLogContent);

                // TestinExternalLog
                var logContent = string.Format(mLogFmt, 3 - QualitySetting.GraphicLevel);
                DBOSManager.getOSBridge().log2OSCmd("TestinExternalLog", logContent);

                // 云梯第一次进入场景
                ControlServerLogHelper.Instance.PostCloudLadderEventAction(CloudLadderMarkEnum.enter_game);
            }

            FieldInfo fi = sceneId.GetType().GetField(sceneId.ToString());

            DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
            string scene = (attributes.Length > 0) ? attributes[0].Description : sceneId.ToString();

            LanguageType languageType = Const.Language;

            fi         = languageType.GetType().GetField(languageType.ToString());
            attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
            string language = (attributes.Length > 0) ? attributes[0].Description : languageType.ToString();

            //GameDebug.LogError("PostPlayerFollowRecord scene: " + scene);

            GlobalConfig globalConfig = GlobalConfig.GetInstance();

            GlobalConfig.LoginInfoStruct loginInfo = globalConfig.LoginInfo;
            IBridge bridge = DBOSManager.getOSBridge();

            string url = globalConfig.CommonURL + "playerFollowRecord";

            url += "?gameMark=" + globalConfig.GameMark;
            if (string.IsNullOrEmpty(loginInfo.AccName) == true)
            {
                url += "&account=none";
            }
            else
            {
                url += "&account=" + loginInfo.AccName;
            }
            if (loginInfo.ServerInfo != null)
            {
                url += "&server_id=" + loginInfo.ServerInfo.ServerId;
            }
            url += "&role_id=" + loginInfo.RId;
            url += "&role_name=" + WWW.EscapeURL(loginInfo.Name);
            url += "&level=" + loginInfo.Level;
            if (isEnterGame == true)
            {
                url += "&vip=" + VipHelper.GetVipValidLevel();
            }
            else
            {
                url += "&vip=0";
            }
            url += "&provider=" + globalConfig.SDKName;
            url += "&scene=" + WWW.EscapeURL(scene);
            url += "&msg=" + WWW.EscapeURL(desc);
            url += "&position=0";
            url += "&os=" + globalConfig.PlatformName;
            url += "&osVer=" + bridge.getOSVersion();
            url += "&brand=" + WWW.EscapeURL(bridge.getBrand());
            url += "&model=" + WWW.EscapeURL(bridge.getPhoneModel());
            url += "&job=" + loginInfo.Job;
            url += "&net=" + bridge.getNetType();
            if (isEnterGame == true)
            {
                if (Game.Instance.ServerTime > 0)
                {
                    url += "&time=" + Game.Instance.ServerTime;
                }
                else
                {
                    url += "&time=" + System.Convert.ToUInt32(xc.Maths.Util.ConvertDateTimeToTimestamp(System.DateTime.Now));;
                }
            }
            else
            {
                url += "&time=0";
            }
            url += "&device_mark=" + globalConfig.DeviceMark;
            url += "&start_time=" + globalConfig.StartTimeStamp;
#if UNITY_IPHONE
            url += "&imei=" + bridge.GetPhoneIDFA();
#else
            url += "&imei=" + bridge.getPhoneIMEI();
#endif
            url += "&mac=" + bridge.getPhoneMAC();
            url += "&imsi=" + bridge.getPhoneIMSI();
            url += "&app_version=" + bridge.getAppVersion();
            url += "&chn_id=" + bridge.getSdkID();

            url += "&carrier=" + WWW.EscapeURL(bridge.getOperator());
            url += "&jbk=" + bridge.isRoot();
            url += "&did=" + bridge.getSDKDeviceID();
            url += "&tz=" + WWW.EscapeURL(bridge.getTimeZone());
            url += "&lang=" + language;
            url += "&width=" + bridge.getWindowWidth();
            url += "&height=" + bridge.getWindowHeigh();
            url += "&apil=" + bridge.getAPILevel();
            url += "&idfa=" + bridge.GetPhoneIDFA();
            url += "&idfv=" + bridge.getPhoneIDFV();
            url += "&ip=" + WWW.EscapeURL(bridge.getLocalIpAddress());
            url += "&wifi=" + WWW.EscapeURL(bridge.getWfName());
            url += "&factory=" + WWW.EscapeURL(bridge.getManufacturer());
            url += "&game_version=" + VersionInfoManager.Instance.GameVersion;
            url += "&appId=" + bridge.getAppID();
            url += "&sdkv=" + bridge.getSDKVersionName();

            HttpRequest.Instance.GET(url, null, null);

            GameDebug.Log("PostPlayerFollowRecord: " + scene);
        }
Ejemplo n.º 6
0
        public void Pay(DBPay.PayItemInfo pay_info)
        {
            if (pay_info == null)
            {
                return;
            }

            var server_id   = 0;
            var server_name = "0";
            var server_info = GlobalConfig.Instance.LoginInfo.ServerInfo;

            if (server_info == null)
            {
                Debug.LogError("OnClickPayButton: server_info is null");
            }
            else
            {
                server_id   = server_info.ServerId;
                server_name = server_info.Name;
            }



#if UNITY_IPHONE
            var pay_request_info = new Dictionary <string, string>();
            //IPHONE 从ProductInfo.json里面读取商品数据
            ProductInfoManager.ProductInfo info = ProductInfoManager.GetInstance().GetProductInfo(pay_info.RmbLow);
            if (info == null)
            {
                //ProductInfo.json   不存在则 读取  C充值商品id.xlsx
                var db_pay_product = DBManager.Instance.GetDB <DBPayProduct>();
                DBPayProduct.PayDroductInfo product_info = db_pay_product.getProductInfo(pay_info.RmbLow);
                pay_request_info.Add("productID", product_info.ProductId);
                pay_request_info.Add("productName", product_info.ProductName);
                pay_request_info.Add("productDesc", product_info.ProductDesc);
            }
            else
            {
                //ProductInfo.json   存在则  读取  ProductInfo.json
                pay_request_info.Add("productID", info.productId);
                pay_request_info.Add("productName", info.productName);
                pay_request_info.Add("productDesc", info.productDesc);
            }
#else
            var db_pay_product = DBManager.Instance.GetDB <DBPayProduct>();
            DBPayProduct.PayDroductInfo product_info = db_pay_product.getProductInfo(pay_info.RmbLow);

            var pay_request_info = new Dictionary <string, string>();
            pay_request_info.Add("productID", product_info.ProductId);
            pay_request_info.Add("productName", product_info.ProductName);
            pay_request_info.Add("productDesc", product_info.ProductDesc);
#endif


            pay_request_info.Add("passport", GlobalConfig.Instance.LoginInfo.AccName);
            pay_request_info.Add("serverID", server_id.ToString());
            pay_request_info.Add("roleId", GlobalConfig.Instance.LoginInfo.RId.ToString());
            pay_request_info.Add("price", pay_info.RmbLow.ToString());
            if (Const.Region == RegionType.HKTW || Const.Region == RegionType.SEASIA)
            {
                pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY_USD"));
            }
            else if (Const.Region == RegionType.KOREA)
            {
                pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY_KR"));
            }
            else
            {
                pay_request_info.Add("currency", GameConstHelper.GetString("GAME_PAYMENT_CURRENCY"));
            }
            pay_request_info.Add("serverName", server_name);
            pay_request_info.Add("roleName", GlobalConfig.Instance.LoginInfo.Name);
            pay_request_info.Add("roleLevel", GlobalConfig.Instance.LoginInfo.Level.ToString());
            pay_request_info.Add("vip", VipHelper.GetVipValidLevel().ToString());                                                     //角色VIP等级
            pay_request_info.Add("coinNum", LocalPlayerManager.Instance.GetMoneyByConst(GameConst.MONEY_DIAMOND).ToString());         //当前玩家身上拥有的金锭数量
            if (DBOSManager.getOSBridge().getAppID() == 529)                                                                          // 卓梦
            {
                pay_request_info.Add("currencyNum", LocalPlayerManager.Instance.GetMoneyByConst(GameConst.MONEY_DIAMOND).ToString()); //当前玩家身上拥有的金锭数量
            }
#if UNITY_IPHONE
            pay_request_info.Add("gameMark", GlobalConfig.Instance.GameMark); //角色VIP等级
#endif


            //使用sdk接口发送充值请求
            string pay_requeset_str = MiniJSON.JsonEncode(new Hashtable(pay_request_info));
            DBOSManager.getDBOSManager().getBridge().pay(pay_requeset_str);
            Debug.Log(string.Format("OnClickPayButton pay_rmb: {0}", pay_info.RmbLow));
        }