Ejemplo n.º 1
0
 public override void onLoginFail(int code)
 {
     Debug.Log(string.Format("on login %d", code));
     if (code == 25)
     {
         ChameleonSDK.runProtocol("qqmsdk_setplat", "wx");
         ChameleonSDK.login();
     }
 }
Ejemplo n.º 2
0
        public override void onLoginFail(int code)
        {
            logList += string.Format("登陆失败: {0}\n", code);

            if (code == 25)
            {
                ChameleonSDK.runProtocol("qqmsdk_setplat", "wx");
                logList += string.Format("try login wx");
                ChameleonSDK.login();
            }
        }
Ejemplo n.º 3
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 100, 50), "Login"))
        {
            ChameleonSDK.login();
        }

        if (GUI.Button(new Rect(110, 10, 100, 50), "Login Guest"))
        {
            ChameleonSDK.loginGuest();
        }

        if (GUI.Button(new Rect(210, 10, 100, 50), "switchaccount"))
        {
            ChameleonSDK.switchAccount();
        }

        if (GUI.Button(new Rect(310, 10, 100, 50), "antiaddiction"))
        {
            //ChameleonSDK.antiAddiction();
        }

        if (GUI.Button(new Rect(410, 10, 100, 50), "charge"))
        {
            //ChameleonSDK.charge();
        }

        if (GUI.Button(new Rect(510, 10, 100, 50), "buy"))
        {
            //ChameleonSDK.buy();
        }

        if (GUI.Button(new Rect(610, 10, 100, 50), "showtoolbar"))
        {
            ChameleonSDK.createAndShowToolBar(ChameleonSDK.ToolbarPosition.TOOLBAR_BOTTOM_LEFT);
        }

        if (GUI.Button(new Rect(710, 10, 100, 50), "hidetoolbar"))
        {
            ChameleonSDK.showFloatBar(ChameleonSDK.ToolbarPosition.TOOLBAR_BOTTOM_LEFT, false);
        }
    }
Ejemplo n.º 4
0
 void OnDestroy()
 {
     ChameleonSDK.destroy();
 }
Ejemplo n.º 5
0
 void Awake()
 {
     mListener = new Listener();
     ChameleonSDK.registerListener(mListener);
 }
Ejemplo n.º 6
0
    /*
     * private IEnumerator requestLogin(string loginInfo) {
     *      Hashtable data = (Hashtable)JSON.JsonDecode (loginInfo);
     *      HTTP.Request req = new HTTP.Request("post", "http://118.192.73.182:8080", data);
     *      req.Send ();
     *      while (!req.isDone) {
     *              yield return null;
     *      }
     *      if (ChameleonSDK.onLoginRsp(req.response.Text)) {
     *              logList += string.Format("成功验证登陆\n");
     *              ChameleonSDK.submitPlayerInfo("游戏中用户ID",
     *                                            "游戏中用户名字",
     *                                            "游戏中用户等级",
     *                                            1, // 大区编号
     *                                            "大区名字" // 注意一定要是选区页面中名字一致
     *                                            );
     *      } else {
     *              logList += string.Format("登陆失败\n");
     *      }
     * }
     */


    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 100, 50), "登陆"))
        {
            logList += "开始登陆\n";
            ChameleonSDK.login();
        }

        if (GUI.Button(new Rect(110, 10, 100, 50), "游客登陆"))
        {
            if (ChameleonSDK.isSupportSwitchAccount())
            {
                logList += "这个渠道不支持游客登陆, 所以走正常的登陆";
            }
            else
            {
                logList += "开始游客登陆\n";
            }
            ChameleonSDK.loginGuest();
        }

        if (GUI.Button(new Rect(210, 10, 100, 50), "切换账户"))
        {
            logList += "开始切换账户\n";
            ChameleonSDK.switchAccount();
        }

        if (GUI.Button(new Rect(310, 10, 100, 50), "反沉迷查询"))
        {
            logList += "开始获取防沉迷\n";
            ChameleonSDK.antiAddiction();
        }

        if (GUI.Button(new Rect(410, 10, 100, 50), "充值"))
        {
            logList += "开始充值\n";
            //this.StartCoroutine(startCharge());
        }

        if (GUI.Button(new Rect(10, 60, 100, 50), "购买"))
        {
            logList += "开始购买\n";
            //this.StartCoroutine(startBuy());
        }

        if (GUI.Button(new Rect(110, 60, 100, 50), "展示工具条"))
        {
            logList += "开始显示toolbar\n";
            ChameleonSDK.createAndShowToolBar(ChameleonSDK.ToolbarPosition.TOOLBAR_BOTTOM_LEFT);
        }

        if (GUI.Button(new Rect(210, 60, 100, 50), "隐藏工具条"))
        {
            logList += "开始隐藏toolbar\n";
            ChameleonSDK.showFloatBar(false);
        }
        if (GUI.Button(new Rect(310, 60, 100, 50), "退出游戏"))
        {
            logList += "开始退出\n";
            ChameleonSDK.destroy();
        }
        if (GUI.Button(new Rect(410, 60, 100, 50), "退出账户"))
        {
            logList += "退出账户\n";
            ChameleonSDK.logout();             // 主动出发退出,是不会有回调的
        }

        GUILayout.BeginArea(new Rect(10, 100, 800, 400));
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(700), GUILayout.Height(400));
        GUILayout.Label(logList);
        GUILayout.EndScrollView();
        GUILayout.EndArea();
    }
Ejemplo n.º 7
0
 public override void onInit(int code)
 {
     logList += string.Format("初始化结果: {0} 渠道名{1}\n", code, ChameleonSDK.getChannelName());
     ChameleonSDK.login();
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("GUI init start");
     ChameleonSDK.init(new Listener(this));
 }