public static PlatformDeviceBindRequest Create(string deviceCode, string product)
    {
        PlatformDeviceBindRequest param = ReferencePool.Acquire <PlatformDeviceBindRequest>();

        param.deviceCode = deviceCode;
        param.product    = product;
        return(param);
    }
Exemplo n.º 2
0
 public void GetDeviceBindList(PlatformDeviceBindRequest request, Action <PlatformDeviceBindResponse> response)
 {
     Request(WebUtility.GetUFUrl("device/bind-list"), request, (res) =>
     {
         ReferencePool.Release(request);
         PlatformDeviceBindResponse deviceBind = Utility.Json.ToObject <PlatformDeviceBindResponse>(res);
         if (deviceBind == null)
         {
             Log.Error("Parse PlatformDeviceBindResponse failure.");
             return;
         }
         if (response != null)
         {
             response(deviceBind);
         }
     });
 }
Exemplo n.º 3
0
        protected override internal void OnEnter(ProcedureOwner procedureOwner)
        {
            base.OnEnter(procedureOwner);

            m_changeToLevel       = false;
            m_changeToTileMap     = false;
            m_changeToCineMachine = false;

            if (procedureOwner.GetData <VarBool>(Constant.ProcedureData.Gaming) != null &&
                procedureOwner.GetData <VarBool>(Constant.ProcedureData.Gaming).Value)
            {
                GameEntry.UI.OpenUIForm(UIFormId.MapForm);
                return;
            }

            string deviceCode = GetDeviceCode();

            GameEntry.WebRequestCB.GetDeviceBindList(
                PlatformDeviceBindRequest.Create(
                    deviceCode,
                    "nldmx"),
                (deviceBind) => {
                if (deviceBind.code == 0)
                {
                    string userId = deviceBind.guest;
                    if (deviceBind.userMap != null && deviceBind.userMap.Count > 0)
                    {
                        foreach (var kv in deviceBind.userMap)
                        {
                            //Debug.LogError(kv.Key + "  " + kv.Value.uid);
                            if (kv.Value.thridIds != null && kv.Value.thridIds.Count > 0)
                            {
                                foreach (var kkvv in kv.Value.thridIds)
                                {
                                    if ("wx".Equals(kkvv.Key))
                                    {
                                        VarBool isBind = new VarBool(true);
                                        GameEntry.DataNode.SetData(Constant.DataNode.IsWXBind, isBind);
                                        userId = kv.Value.uid;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    VarString v_userId = new VarString(userId);
                    GameEntry.DataNode.SetData(Constant.DataNode.UserId, v_userId);

                    if ((bool)GameEntry.DataNode.GetData(Constant.DataNode.IsWXBind).GetValue())
                    {
                        GameEntry.UI.OpenUIForm(UIFormId.MapForm);
                    }
                    else
                    {
                        GameEntry.UI.OpenUIForm(UIFormId.StageForm);
                    }
                }
                else
                {
                    Log.Error("获取绑定信息异常");
                }
            });
        }