/// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 private string CreateLoginCheckURL()
 {
     if (mCurrentUser == null)
     {
         return null;
     }
     string url = "";
     if (true)//(GameManager.Instance.isTestServer)
     {
         url = "http://www.xupule.cn/nbf/index.php/login/check.html";
     }
     else
     {
         //url = "http://web.fu-5.xyz/nbf/index.php/login/check.html";
     }
     if (string.IsNullOrEmpty(url))
     {
         return "";
     }
     StringBuilder builder = new StringBuilder(url);
     builder.Append("?gmid=");
   //  builder.Append(GameManager.Instance.gameKey);
     builder.Append("&agentid=");
    // builder.Append(ConfigInfo.WBFlag.ToString());
     builder.Append("&uin=");
     builder.Append(mCurrentUser.getChannelUserId());
     builder.Append("&sess=");
     builder.Append(SDKUtils.ToUrlEncode(mCurrentUser.getToken()));
     builder.Append("&ext1=");
     builder.Append("&ext2=");
     return builder.ToString();
 }
Example #2
0
    public void StartAnimate(string msgStr)
    {
        msgLabel      = SDKUtils.GetChildComponent <Text>("Label", transform);
        msgBackground = SDKUtils.GetChildComponent <Image>("Background", transform);
        Debug.Assert(msgLabel);
        Debug.Assert(msgBackground);

        msgLabel.text = msgStr;

        StartCoroutine(MsgCoroutine());
    }
Example #3
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance       = GetComponent <SDKUtils>();
            gameObject.name = _gameObjectName;
        }

        DontDestroyOnLoad(gameObject);
        init();
    }
Example #4
0
    public void OnInit()
    {
        if (!IsInit)
        {
            m_MsgTempllatePool = new Stack <XUIMidMsgAnimator>();

            MsgTemplate = SDKUtils.GetChildComponent <Transform>(transform, "MsgTemplate");
            if (MsgTemplate)
            {
                MsgTemplate.gameObject.SetActive(false);
            }
            else
            {
                Debug.LogError("MsgTemplate 在子节点找不到,请检查!");
            }
            IsInit = true;
        }
    }
Example #5
0
    /// <summary>
    /// 初始化
    /// </summary>
    private void Init()
    {
        //获取子渠道
        object metaValue       = SDKUtils.GetMetaData(SDKDefine.AndroidSubChannelMeta.key);
        string subChannelValue = metaValue != null?metaValue.ToString() : "";

        if (string.IsNullOrEmpty(subChannelValue))
        {
            subChannelValue = SDKDefine.AndroidSubChannelMeta.value;
        }
        Debug.Log("AndroidChannelSDKMgr::GetMetaData-> SubChannel = " + subChannelValue);
        user.setSubChannel(subChannelValue.Trim());

        //判断是否使用sdk退出方式
        if (user.haveChannelSDK)
        {
            metaValue = SDKUtils.GetMetaData(SDKDefine.AndroidExitTypeMeta.key);
            string exitType = metaValue != null?metaValue.ToString() : "";

            Debug.Log("AndroidChannelSDKMgr::GetMetaData-> exittype = " + exitType);
            if (exitType == SDKDefine.AndroidExitTypeMeta.value) // game:游戏的退出方式;sdk:sdk的退出方式
            {
                // user.useChannelSDKExit = false;
            }
            else
            {
                // user.useChannelSDKExit = true;
            }
        }
        else
        {
            // user.useChannelSDKExit = false;
        }

        //设置监听器
        SetInitListener();
        SetLoginListener();
        SetExitListener();
        SetPayListener();
    }
Example #6
0
    private static string DeterminSDKHelper(out string channelId, out bool haveChannelSDK)
    {
        string SDKHelperName = "";

        object metaValue = SDKUtils.GetMetaData(SDKDefine.OneSDKDefaultChannelIDMeta.key);

        channelId = metaValue != null?metaValue.ToString() : "";

        channelId = channelId.Trim();
        if (channelId != "")
        {
            //如果易接的channelid 不为空就表示使用的易接的SDK
            SDKHelperName  = "AndroidMultSDKHelper";
            haveChannelSDK = true;
        }
        else
        {
            metaValue = SDKUtils.GetMetaData(SDKDefine.MHJSDKDefaultChannelIDMeta.key);
            channelId = metaValue != null?metaValue.ToString() : "";

            channelId = channelId.Trim();
            Debug.Log("channelId = " + channelId.ToString());
            if (channelId == SDKDefine.MHJSDKDefaultChannelIDMeta.value && channelId != "")
            {
                //如果我们自己接的渠道的 channelid 不为空且不是默认值,表示自己接入的渠道
                SDKHelperName  = "AndroidSingleSDKHelper";
                haveChannelSDK = true;
            }
            else
            {
                SDKHelperName  = "ChannelSDKHelperBase";
                haveChannelSDK = false;
            }
        }

        Debug.Log("AndroidChannelSDKMgr::DeterminSDKHelper->SDKHelperName = " + SDKHelperName);
        return(SDKHelperName);
    }
Example #7
0
    public XUIMidMsgAnimator PoolGet()
    {
        XUIMidMsgAnimator msgInstance = null;

        if (m_MsgTempllatePool.Count > 0)
        {
            msgInstance = m_MsgTempllatePool.Pop();
        }

        if (msgInstance == null)
        {
            GameObject newGameObj = GameObject.Instantiate(MsgTemplate.gameObject) as GameObject;
            msgInstance = newGameObj.AddComponent <XUIMidMsgAnimator>();
            msgInstance.transform.parent = this.transform;
            msgInstance.UICtrler         = this;
        }


        SDKUtils.ResetTransform(msgInstance.transform);
        msgInstance.gameObject.SetActive(true);

        return(msgInstance);
    }
Example #8
0
        // ReSharper disable once UnusedMethodReturnValue.Local
        private static TransactionEvent MoveAmount(HFClient client, Channel channel, ChaincodeID chaincodeID, string from, string to, string moveAmount, IUser user)
        {
            List <ProposalResponse> successful = new List <ProposalResponse>();
            List <ProposalResponse> failed     = new List <ProposalResponse>();

            ///////////////
            // Send transaction proposal to all peers
            TransactionProposalRequest transactionProposalRequest = client.NewTransactionProposalRequest();

            transactionProposalRequest.SetChaincodeID(chaincodeID);
            transactionProposalRequest.SetFcn("move");
            transactionProposalRequest.SetArgs(from, to, moveAmount);
            transactionProposalRequest.SetProposalWaitTime(testConfig.GetProposalWaitTime());
            if (user != null)
            {
                // specific user use that
                transactionProposalRequest.SetUserContext(user);
            }

            Util.COut("sending transaction proposal to all peers with arguments: move(%s,%s,%s)", from, to, moveAmount);

            List <ProposalResponse> invokePropResp = channel.SendTransactionProposal(transactionProposalRequest);

            foreach (ProposalResponse response in invokePropResp)
            {
                if (response.Status == ChaincodeResponse.ChaincodeResponseStatus.SUCCESS)
                {
                    Util.COut("Successful transaction proposal response Txid: {0} from peer {1}", response.TransactionID, response.Peer.Name);
                    successful.Add(response);
                }
                else
                {
                    failed.Add(response);
                }
            }

            // Check that all the proposals are consistent with each other. We should have only one set
            // where all the proposals above are consistent.
            List <HashSet <ProposalResponse> > proposalConsistencySets = SDKUtils.GetProposalConsistencySets(invokePropResp);

            if (proposalConsistencySets.Count != 1)
            {
                Assert.Fail($"Expected only one set of consistent move proposal responses but got {proposalConsistencySets.Count}");
            }

            Util.COut("Received {0} transaction proposal responses. Successful+verified: {1} . Failed: {2}", invokePropResp.Count, successful.Count, failed.Count);
            if (failed.Count > 0)
            {
                ProposalResponse firstTransactionProposalResponse = failed.First();

                throw new ProposalException($"Not enough endorsers for invoke(move {from},{to},{moveAmount}):{firstTransactionProposalResponse.Status} endorser error:{firstTransactionProposalResponse.Message}. Was verified:{firstTransactionProposalResponse.IsVerified}");
            }

            Util.COut("Successfully received transaction proposal responses.");

            ////////////////////////////
            // Send transaction to orderer
            Util.COut("Sending chaincode transaction(move %s,%s,%s) to orderer.", from, to, moveAmount);
            if (user != null)
            {
                return(channel.SendTransaction(successful, user, testConfig.GetTransactionWaitTime() * 1000));
            }

            return(channel.SendTransaction(successful, testConfig.GetTransactionWaitTime() * 1000));
        }