void OnButtonSpin()
    {
        if (m_clerk.Spinning)
        {
            DebugConsole.Log("I'm spinning!");
            DialogBase.Show("MESSAGE", "I'm spinning!SpinSeqNo:" + m_clerk.SeqNo);
            return;
        }
        else
        {
            m_clerk.SpinCount++;
            m_spinCheck      = m_clerk.SpinCount;
            m_clerk.Spinning = true;
        }

        if (m_clerk.Win > 0)                // 有奖励没有领取
        {
            DebugConsole.Log("Error!");     // 当前是自动领取
            DialogBase.Show("MESSAGE", "有奖励没有领取");
            m_clerk.Displays.ShowJumpWin(); // 点击领取
        }
        else
        {
            m_clerk.Requests.ReqSpin();
        }
    }
    void Register()
    {
        if (m_email == "")
        {
            DialogBase.Show("REGISTER EMAIL", "INVALID EMAIL(NULL).");
            return;
        }

        string expression = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)" + @"|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";

        if (!System.Text.RegularExpressions.Regex.IsMatch(m_email, expression))
        {
            DialogBase.Show("REGISTER EMAIL", "INVALID EMAIL ADDRESS.");
            return;
        }

        if (m_pwd != m_pwd2)
        {
            DialogBase.Show("REGISTER EMAIL", "YOUR NEW AND CONFIRM PASSWORDS\n ARE DIFFERENT, PLEASE RETRY.");
            return;
        }

        if (m_pwd == "")
        {
            DialogBase.Show("REGISTER EMAIL", "INVALID PASSWORD(NULL).");
            return;
        }

        m_pwdMD5 = Tools.GetMD5(m_pwd);
        Reception recp = GameObject.Find("Reception").GetComponent <Reception>();

        recp.RegisterByEmail(m_email, m_pwdMD5, AfterRegisterByEmail);
    }
Exemple #3
0
    private string GetUUID()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            if (jc == null)
            {
                DialogBase.Show("ANDROID", "js is null");
                return("");
            }

            AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
            if (jo == null)
            {
                DialogBase.Show("ANDROID", "jo is null");
                return("");
            }

            try
            {
                string uuid = jo.Call <string>("GetUID");
                return(uuid);
            }
            catch (System.Exception e)
            {
                DialogBase.Show("ANDROID", e.Message);
            }
        }
        return("");
    }
Exemple #4
0
    public void ReqSpin()
    {
        if (!m_clerk.Login)
        {
            DebugConsole.Log("!Login, cant reqspin");
            // Show dialog here
            DialogBase.Show("MESSAGE", "!Login, cant reqspin");
            return;
        }

        TigerReq tigerReq = new TigerReq();

        tigerReq.BetGold = m_clerk.Bet; // only 10, 20, 30
        // SeqNo 当前用来对应消息ID
        m_clerk.SeqNo  = m_clerk.SpinCount;
        tigerReq.SeqNo = m_clerk.SpinCount;
        m_clerk.Begin(); // 开始计时

        tigerReq.TigerNo = m_clerk.TigerNo;
        for (int i = 0; i < m_clerk.Lines; ++i)
        {
            tigerReq.Lines.Add(i);
        }

        m_net.SendEnqueue(Constants.Tiger_Spin, 0, tigerReq);
    }
Exemple #5
0
    static public void DoBuy(string buykey)
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            if (jc == null)
            {
                DialogBase.Show("ANDROID", "js is null");
                return;
            }

            AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
            if (jo == null)
            {
                DialogBase.Show("ANDROID", "jo is null");
                return;
            }

            try
            {
                //string uuid = jo.CallStatic<string>("GetUUID");
                jo.Call("Pay", buykey);
            }
            catch (System.Exception e)
            {
                DialogBase.Show("ANDROID", e.Message);
            }
        }
    }
    void Modify()
    {
        if (m_pwd == "")
        {
            DialogBase.Show("Modify Password", "Invalid password(NULL).");
            return;
        }

        if (m_npwd != m_npwd2)
        {
            DialogBase.Show("Modify Password", "Your new and confirm passwords\n are different, Please retry.");
            return;
        }

        if (m_npwd == "")
        {
            DialogBase.Show("Modify Password", "Invalid new password(NULL).");
            return;
        }

        m_pwdMD5  = Tools.GetMD5(m_pwd);
        m_npwdMD5 = Tools.GetMD5(m_npwd);
        Reception recp = GameObject.Find("Reception").GetComponent <Reception>();

        recp.ModifyPassword(m_pwdMD5, m_npwdMD5, AfterModifyPassword);
    }
    /// <summary>
    /// ダイアログを表示する
    /// </summary>
    public IEnumerator DialogShow(DialogSelector.DialogType type, DialogData data = null)
    {
        DialogBase dialog = dialogSelector.GetDialog(type);

        Debug.Log("ダイアログ = " + dialog);
        if (dialog != null)
        {
            //ダイアログがひとつも表示されていなければ背景を表示する
            if (showDialogList.Count == 0)
            {
                backgroundObject.SetActive(true);
            }

            //対象ダイアログを生成
            DialogBase targetDialog = DialogBase.Instantiate <DialogBase>(dialog);
            targetDialog.transform.SetParent(contentArea.transform, false);
            showDialogList.Add(targetDialog);
            //ダイアログ表示開始
            yield return(targetDialog.Show(data));

            //表示が終わったらダイアログを破棄
            showDialogList.Remove(targetDialog);
            Destroy(targetDialog.gameObject);
            if (showDialogList.Count == 0)
            {
                backgroundObject.SetActive(false);
            }
        }
    }
Exemple #8
0
    // Update is called once per frame
    void Update()
    {
        //因为写入文件的操作必须在主线程中完成,所以在Update中哦给你写入文件。
        if (mWriteTxt.Count > 0)
        {
            string[] temp = mWriteTxt.ToArray();
            foreach (string t in temp)
            {
                if (Application.platform == RuntimePlatform.Android)
                {
                    if (m_ajo == null)
                    {
                        AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                        if (jc == null)
                        {
                            DialogBase.Show("ANDROID", "js is null");
                            return;
                        }

                        AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
                        if (jo == null)
                        {
                            DialogBase.Show("ANDROID", "jo is null");
                            return;
                        }
                        m_ajo = jo;
                    }

                    try
                    {
                        const string TAG = "FirstStudio.sloter";
                        m_ajo.Call("DebugLog", TAG, t);
                    }
                    catch (System.Exception e)
                    {
                        DialogBase.Show("ANDROID", e.Message);
                    }
                }
                mWriteTxt.Remove(t);
            }
        }

        if (GlobalVars.instance.Testing && mDirty)
        {
            mDirty = false;
            string[] temp = mLines.ToArray();
            string   s    = "";
            foreach (string item in temp)
            {
                s += item;
                s += "\n";
            }
            m_text.text = s;
        }
    }
    public void AfterRegisterByEmail()
    {
        DebugConsole.Log("AfterRegisterByEmail");
        GlobalVars.instance.LoginType  = Constants.Login_Email;
        GlobalVars.instance.LoginEmail = m_email;
        GlobalVars.instance.LoginPwd   = m_pwdMD5;
        // 清空旧的GUID
        DebugConsole.Log("Clear old guid:" + GlobalVars.instance.LoginGuid);
        GlobalVars.instance.LoginGuid = "";

        DialogBase.Show("Register by email", "Register successfully!");
    }
Exemple #10
0
    void UpdateTigerResp(TigerResp tigerResp)
    {
        // 结束计时
        //long elapse = m_clerk.End();
        m_clerk.SeqNo = 0;
        ////test
        //{
        //    tigerResp.Pos.Clear();
        //    tigerResp.Pos.Add(4);
        //    tigerResp.Pos.Add(1);
        //    tigerResp.Pos.Add(4);
        //    tigerResp.Pos.Add(4);
        //    tigerResp.Pos.Add(2);

        //    tigerResp.Bonus.Clear();
        //    TigerBonus item = new TigerBonus();
        //    item.Pattern = 2;
        //    item.Type = 1;
        //    item.Data1 = 2;

        //    tigerResp.Bonus.Add(item);
        //    tigerResp.Current.Gold = 2004810;

        //}

        // 本地减金币先
        m_clerk.Gold -= m_clerk.Bet * m_clerk.Lines;

        // 滚动开始
        PlayAudio(Constants.Audio.Audio_ReelRolling);
        for (int i = 0; i < tigerResp.Pos.Count; ++i)
        {
            int      pos  = tigerResp.Pos[i];
            string   name = "reel" + (i + 1).ToString();
            SlotReel reel = GameObject.Find(name).GetComponent <SlotReel>();
            //DebugConsole.Log("pos" + i.ToString() + ":" + pos.ToString());

            if (i == tigerResp.Pos.Count - 1)
            {
                if (null == tigerResp.Bonus)
                {
                    DialogBase.Show("MESSAGE", "null == tigerResp.Bonus");
                }
                reel.Spin(pos + 2, tigerResp.Bonus);
            }
            else
            {
                reel.Spin(pos + 2, null);
            }
        }

        // 中奖效果在Reel中滞后实现
    }
Exemple #11
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            //这个地方可以写“再按一次退出”的提示
            if (DialogBase.Actived())
            {
                DebugConsole.Log("Hide in Clerk");
                DialogBase.Hide();
            }
            else
            {
                DebugConsole.Log("Show in Clerk");
                DialogBase.Show("ESC", "Exit game?", QuitGame);
            }
            //m_escapeTimes++;
            //StartCoroutine("resetTimes");
            //if (m_escapeTimes > 1)
            //{
            //    Application.Quit();
            //}
        }

        if (!m_net.IsRunning())
        {
            return;
        }

        if (m_net.CheckReconnect())
        {
            CheckLogin();
        }

        ProtoPacket packet = new ProtoPacket();

        if (m_net.RecvTryDequeue(ref packet))
        {
            m_displays.Execute(packet);
        }

        GameObject recp = GameObject.Find("Reception");

        if (recp == null)
        {
            if (m_broadcastMsg != "")
            {
                // 有系统消息,平移吧
                GameObject goBroadcast = GameObject.Find("BroadcastText");
                Vector3    pos         = goBroadcast.transform.localPosition;
                pos.x -= 50 * Time.deltaTime;
                goBroadcast.transform.localPosition = pos;

                // 从600~-600
                if (goBroadcast.transform.localPosition.x < -600)
                {
                    m_broadcastMsg = "";
                }
            }
            else
            {
                m_broadcastMsg = Lobby.getInstance().GetBroadcast();
                if (m_broadcastMsg != "")
                {
                    GameObject goBroadcast = GameObject.Find("BroadcastText");
                    goBroadcast.GetComponent <Text>().text = m_broadcastMsg;
                    goBroadcast.transform.localPosition    = new Vector3(600, 0, 0);
                }
            }

            // 不是Lobby,需要处理Reception消息
            // 如广播,以及store相关的
            ProtoNet net = Reception.Net();
            if (net != null)
            {
                packet = null;
                packet = new ProtoPacket();
                if (net.RecvTryDequeue(ref packet))
                {
                    switch (packet.cmdId)
                    {
                    case Constants.Lion_GetShopItems:
                    {
                        Lobby.getInstance().ShopList = (ShopList)packet.proto;
                        DebugConsole.Log("ShopName:" + Lobby.getInstance().ShopList.ShopName);
                        if (packet.callback != null)
                        {
                            packet.callback();
                        }
                    }
                    break;

                    case Constants.Lion_BroadcastSystemMessage:
                    {
                        Tools.PlayNotification(Constants.Audio.Audio_Notification);
                        StringValue sv = (StringValue)packet.proto;
                        Lobby.getInstance().AddBroadcast(sv.Value);
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
        }
    }
Exemple #12
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (DialogBase.Actived())
            {
                DebugConsole.Log("Hide");
                DialogBase.Hide();
            }
            else
            {
                DebugConsole.Log("Show");
                DialogBase.Show("ESC", "Are you sure to exit game?", QuitGame);
            }
        }

        if (m_broadcastMsg != "")
        {
            // 有系统消息,平移吧
            GameObject goBroadcast = GameObject.Find("BroadcastText");
            Vector3    pos         = goBroadcast.transform.localPosition;
            pos.x -= 50 * Time.deltaTime;
            goBroadcast.transform.localPosition = pos;

            // 从600~-600
            if (goBroadcast.transform.localPosition.x < -600)
            {
                m_broadcastMsg = "";
            }
        }
        else
        {
            m_broadcastMsg = Lobby.getInstance().GetBroadcast();
            if (m_broadcastMsg != "")
            {
                GameObject goBroadcast = GameObject.Find("BroadcastText");
                goBroadcast.GetComponent <Text>().text = m_broadcastMsg;
                goBroadcast.transform.localPosition    = new Vector3(600, 0, 0);
            }
        }

        if (m_net == null || !m_net.IsRunning())
        {
            // 主动结束了
            return;
        }

        if (m_net.CheckReconnect())
        {
            CheckLogin();

            DialogReconnect.Hide();
        }

        ProtoPacket packet = new ProtoPacket();

        if (m_net.RecvTryDequeue(ref packet))
        {
            DebugConsole.Log("Reception handle cmdId:" + packet.cmdId);
            switch (packet.cmdId)
            {
            case Constants.Lion_QuickLoginInfo:
            {
                Lobby.getInstance().UserInfo = (LionUserInfo)packet.proto; // 更新LionUser
                m_login = true;
                UpdateUserInfoUI();                                        // 更新大厅主界面中信息
                if (packet.callback != null)
                {
                    packet.callback();
                }
            }
            break;

            case Constants.Lion_GetProfile:
            {
                LionUserInfo usrInfo = (LionUserInfo)packet.proto;        // 更新LionUser
                if (usrInfo.UserId == Lobby.getInstance().UId)
                {
                    Lobby.getInstance().UserInfo = usrInfo;
                }
                Lobby.getInstance().QueryUserInfo = usrInfo;

                if (packet.callback != null)
                {
                    // 通常这里显示个人信息对话框
                    packet.callback();
                }
            }
            break;

            case Constants.Lion_GetTigerStat:
            {
                Lobby.getInstance().TigerStatInfo = (TigerStat)packet.proto;
                if (packet.callback != null)
                {
                    packet.callback();
                }
            }
            break;

            case Constants.Lion_GetFriendRequests:
            case Constants.Lion_GetFriends:
            {
                Lobby.getInstance().FriendIDArray = (LongArray)packet.proto;
                if (packet.callback != null)
                {
                    GetFriendSummary(packet.callback);
                }
                else
                {
                    GetFriendSummary(ShowFriendsDlg);
                }
            }
            break;

            case Constants.Lion_GetFriendSummary:
            {
                Lobby.getInstance().CurrentSummaryList = (FriendSummaryList)packet.proto;
                DebugConsole.Log("Summary count:" + Lobby.getInstance().CurrentSummaryList.Data.Count);
                if (packet.callback != null)
                {
                    packet.callback();
                }
            }
            break;

            case Constants.Lion_IgnoreFriend:
            case Constants.Lion_AcceptFriend:
            case Constants.Lion_AddFriend:
            case Constants.Lion_DeleteFriend:
            {
                Status stat = (Status)packet.proto;
                if (stat.Code == 0)        // successful
                {
                    if (packet.callback != null)
                    {
                        packet.callback();
                    }
                }
                else
                {
                    DebugConsole.Log(stat.Desc);
                }
            }
            break;

            case Constants.Lion_Redirect:
            {
                Lobby.getInstance().RedirectInfo = (RedirectResp)packet.proto;
                // 切换到游戏场景中
                //m_net.Close();
                DebugConsole.Log("Reception enter slot scene");
                Global.NextSceneName = "slot";
                SceneManager.LoadScene("loading");
            }
            break;

            case Constants.Lion_UpdateProfile:
            {
                DebugConsole.Log("Lion_UpdateProfile");
                Status stat = (Status)packet.proto;
                if (stat.Code == 0)        // successful
                {
                    if (packet.callback != null)
                    {
                        packet.callback();
                    }
                }
                else
                {
                    DebugConsole.Log(stat.Desc);
                }
            }
            break;

            case Constants.Lion_NotifyWeeklyLogin:
            {
                // 连续登录奖励
                // NotifyWeeklyLogin 返回的intvalue是0-6,0表示今天登陆了(昨天没登录)
                IntValue iv = (IntValue)packet.proto;
                DialogDailyBonus.Show(iv.Value);

                //ExplodeCoin.Show();
            }
            break;

            case Constants.Lion_TakeLoginBonus:
            {
                LongArray la = (LongArray)packet.proto;
                // la[0] 奖励金币数
                // la[1] 最终总数
                if (la.Data.Count >= 2)
                {
                    Lobby.getInstance().UserInfo.Gold = la.Data[1];
                    // 若有动画,在此添加
                    JumpAndMoveCoins(6, UpdateUserInfoUI);
                }
            }
            break;

            case Constants.Lion_NotifyFreeBonus:
            {
                // 第一次登陆的时候,数据库里面没有数据,所以返回0
                // 后端推送,倒计时剩余时间长度(毫秒),如果小于等于0,直接显示奖励
                // 免费奖励
                LongValue lv       = (LongValue)packet.proto;
                long      curEpoch = (System.DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000;
                Lobby.getInstance().FreeBonusEpoch = curEpoch + lv.Value;
                UpdateCountDown();
            }
            break;

            case Constants.Lion_TakeFreeBonus:
            {
                LongArray la = (LongArray)packet.proto;
                if (la.Data.Count >= 2)
                {
                    Lobby.getInstance().UserInfo.Gold = la.Data[1];
                    // 若有动画,在此添加
                    FlyCoin(Constants.Bonus_Free);
                    UpdateUserInfoUI();
                }
            }
            break;

            case Constants.Lion_BuyItem:
            {
                Status stat = (Status)packet.proto;
                // 更新购买相关的:金币 or 背包
                DebugConsole.Log("Buy item return:" + stat.Code.ToString());
                if (stat.Code == 0)        // successful
                {
                    if (packet.callback != null)
                    {
                        packet.callback();
                    }
                }
                else
                {
                    DebugConsole.Log(stat.Desc);
                }
            }
            break;

            case Constants.Lion_Register:
            {
                Status stat = (Status)packet.proto;
                DebugConsole.Log("Register by email return:" + stat.Code.ToString());
                if (stat.Code == 0)        // successful
                {
                    if (packet.callback != null)
                    {
                        packet.callback();
                    }
                }
                else
                {
                    DebugConsole.Log(stat.Desc);
                    DialogBase.Show("Register by email", "Error:" + stat.Desc);
                }
            }
            break;

            case Constants.Lion_ModPass:
            {
                Status stat = (Status)packet.proto;
                DebugConsole.Log("Modify password return:" + stat.Code.ToString());
                if (stat.Code == 0)        // successful
                {
                    if (packet.callback != null)
                    {
                        packet.callback();
                    }
                }
                else
                {
                    DebugConsole.Log(stat.Desc);
                    DialogBase.Show("Modify password", "Error:" + stat.Desc);
                }
            }
            break;

            case Constants.Lion_RefreshGold:
            {
                LongValue lv = (LongValue)packet.proto;
                DebugConsole.Log("Refresh gold:" + lv.ToString());
                Lobby.getInstance().UserInfo.Gold = lv.Value;
                UpdateUserInfoUI();
            }
            break;

            case Constants.Lion_GetShopItems:
            {
                Lobby.getInstance().ShopList = (ShopList)packet.proto;
                DebugConsole.Log("ShopName:" + Lobby.getInstance().ShopList.ShopName);
                if (packet.callback != null)
                {
                    packet.callback();
                }
            }
            break;

            case Constants.Lion_BroadcastSystemMessage:
            {
                Tools.PlayNotification(Constants.Audio.Audio_Notification);
                StringValue sv = (StringValue)packet.proto;
                Lobby.getInstance().AddBroadcast(sv.Value);
            }
            break;

            case Constants.Lion_GetItems:
            {
                //
                Lobby.getInstance().UserItemList = (UserItemList)packet.proto;

                if (packet.callback != null)
                {
                    packet.callback();
                }
                else
                {
                    DialogBag.Show(null);
                }
            }
            break;

            case Constants.Reconnect:
            {
                // 展示重连对话框,直到重连成功
                if (packet.msgId == 1)
                {
                    ProtoNet.WriteLog("Reconnecting...");
                    // 3s后Display中重连
                    m_net.CheckReconnect(3);
                    DialogReconnect.Show();
                }
            }
            break;

            case Constants.Error:
            {
                // 展示错误
                Status stat = (Status)packet.proto;
                string err  = "Error:" + stat.Code.ToString() + "-" + stat.Desc;
                DialogBase.Show("ERROR", err);
            }
            break;

            default:
            {
                DebugConsole.Log("Reception invalid cmdId:" + packet.cmdId);
            }
            break;
            }
        }
    }
Exemple #13
0
    void OnClick(GameObject sender)
    {
        Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton);

        int btnIndex = GetBtnIndexFromName(sender.name);

        if (btnIndex < 0)
        {
            DebugConsole.Log("Cant find button:" + sender.name);
            return;
        }

        switch ((Constants.LobbyBtn)btnIndex)
        {
        case Constants.LobbyBtn.Btn_Slot:
        {
            // 检查是否登录
            if (m_login)
            {
                Redirect();
            }
            else
            {
                WorkDone callBack = new WorkDone(Redirect);
                QuickLogin(callBack);
            }
        }
        break;

        case Constants.LobbyBtn.Btn_Poker:
        {
            //DialogBase.Show("POKER", "Exit game?", QuitGame);
        }
        break;

        case Constants.LobbyBtn.Btn_Option:
        {
            DialogOption.Show();
        }
        break;

        case Constants.LobbyBtn.Btn_Avatar:
        case Constants.LobbyBtn.Btn_Head:
        {
            GetProfile(Lobby.getInstance().UId, ShowPersonalInfoDlg);
        }
        break;

        case Constants.LobbyBtn.Btn_Message:
        {
            DialogMessage.Show();
        }
        break;

        case Constants.LobbyBtn.Btn_Credits:
        {
            DialogStore.Show(0);
        }
        break;

        case Constants.LobbyBtn.Btn_Gems:
        {
            DialogStore.Show(1);
        }
        break;

        case Constants.LobbyBtn.Btn_Friends:
        {
            // 根据ActivePage获取数据
            GetFriends();
        }
        break;

        case Constants.LobbyBtn.Btn_FreeBonus:
        {
            TakeFreeBonus();
        }
        break;

        case Constants.LobbyBtn.Btn_Bag:     // Bag
        {
            GetItems();
        }
        break;

        case Constants.LobbyBtn.Btn_Bingo:
        {
            //DoBuy("jb_1");
        }
        break;

        case Constants.LobbyBtn.Btn_Sj:
        {
            //string uuid = GetUUID();
            //DialogBase.Show("UUID", uuid);
        }
        break;

        default:
            DialogBase.Show("Button clicked", sender.name);
            break;
        }
    }
Exemple #14
0
    void OnClick(GameObject sender)
    {
        Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton);

        DebugConsole.Log(sender.name);
        int btnIndex = GetBtn(sender.name);

        if (btnIndex < 0)
        {
            DebugConsole.Log("Cant find button:" + sender.name);
            return;
        }
        switch ((DialogBtn)btnIndex)
        {
        case DialogBtn.Close:
        {
            GameObject btnObj = GameObject.Find(DialogName);
            if (null == btnObj)
            {
                DebugConsole.Log("null");
            }
            else
            {
                DebugConsole.Log("DoHide");
                DoHide(btnObj);
            }
        }
        break;

        /*
         * case DialogBtn.ProfileOn:
         * case DialogBtn.RecordsOn:
         * {
         *  m_profileOn = !m_profileOn;
         *  // 若是老虎机统计信息,这里需要手动获取一次
         *  if (!m_profileOn)
         *  {
         *      Reception recp = GameObject.Find("Reception").GetComponent<Reception>();
         *      recp.GetTigerStatInfo(m_userInfo.UserId, UpdateTigerStatUI);
         *  }
         *  else
         *  {
         *      UpdateUI();
         *  }
         * }
         * break;*/
        case DialogBtn.UpAvatar:
        {
            //DebugConsole.Log("Upload...");
            DialogSelectAvatar.Show(UpdateAvatar);
        }
        break;

        case DialogBtn.AddFriend:
        {
            DialogBase.Show("FRIEND REQUEST", "Request to add Friend?", AddFriend);
        }
        break;

        case DialogBtn.RemoveFriend:
        {
            DialogBase.Show("FRIEND REMOVE", "Are you sure to remove?", RemoveFriend);
        }
        break;

        case DialogBtn.RegEmail:
        {
            DialogRegEmail.Show();
        }
        break;

        case DialogBtn.ModifyPassword:
        {
            DialogModifyPass.Show();
        }
        break;

        default:
            break;
        }
    }
 public void AfterModifyPassword()
 {
     DebugConsole.Log("AfterModifyPassword");
     GlobalVars.instance.LoginPwd = m_npwdMD5;
     DialogBase.Show("Modify Password", "Modify successfully!");
 }
Exemple #16
0
    void OnClick(GameObject sender)
    {
        Tools.PlayAudio(Constants.Audio.Audio_LobbyClickButton);

        DebugConsole.Log(sender.name);
        int btnIndex = GetBtn(sender.name);

        if (btnIndex < 0)
        {
            DebugConsole.Log("Cant find button:" + sender.name);
            return;
        }
        switch ((DialogBtn)btnIndex)
        {
        case DialogBtn.Close:
        {
            GameObject btnObj = GameObject.Find(DialogName);
            if (null == btnObj)
            {
                DebugConsole.Log("null");
            }
            else
            {
                DebugConsole.Log("DoHide");
                DoHide(btnObj);
            }
        }
        break;

        case DialogBtn.SearchOff:
        case DialogBtn.FriendseOff:
        case DialogBtn.RequestOff:
            break;

        case DialogBtn.FriendsOn:
        {
            Lobby.getInstance().CurrentSummaryList.Data.Clear();
            m_activePage = 0;
            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetFriends(UpdateFriendsUI);
        }
        break;

        case DialogBtn.SearchOn:
        {
            Lobby.getInstance().CurrentSummaryList.Data.Clear();

            m_activePage = 1;
            UpdateSearchUI();
            UpdateUI();
        }
        break;

        case DialogBtn.RequestOn:
        {
            Lobby.getInstance().CurrentSummaryList.Data.Clear();

            m_activePage = 2;
            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetFriendRequests(UpdateRequestUI);
        }
        break;

        case DialogBtn.SearchFriend:
        {
            Reception  recp    = GameObject.Find("Reception").GetComponent <Reception>();
            GameObject goInput = GameObject.Find("InputSearchFriendCode");
            string     uIdStr  = goInput.transform.Find("Text").GetComponent <Text>().text;
            DebugConsole.Log("Search:" + uIdStr);
            long uId = Tools.StringToInt64(uIdStr);

            // 先清理结果
            Lobby.getInstance().CurrentSummaryList.Data.Clear();
            if (uId > 0)
            {
                recp.GetFriendSummaryByUId(uId, UpdateSearchUI);
            }
            else
            {
                UpdateSearchUI();
            }
        }
        break;

        case DialogBtn.FriendLastPage:
        {
            if (Lobby.getInstance().CurrentFriendPage == 0)
            {
                Lobby.getInstance().CurrentFriendPage = Lobby.getInstance().FriendPageCount - 1;
            }
            else
            {
                Lobby.getInstance().CurrentFriendPage--;
            }

            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetFriendSummary(UpdateFriendsUI);
        }
        break;

        case DialogBtn.RequestLastPage:
        {
            if (Lobby.getInstance().CurrentFriendPage == 0)
            {
                Lobby.getInstance().CurrentFriendPage = Lobby.getInstance().FriendPageCount - 1;
            }
            else
            {
                Lobby.getInstance().CurrentFriendPage--;
            }

            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetFriendSummary(UpdateRequestUI);
            recp.HearBeat();
        }
        break;

        case DialogBtn.FriendNextPage:
        {
            Lobby.getInstance().CurrentFriendPage++;
            if (Lobby.getInstance().CurrentFriendPage == Lobby.getInstance().FriendPageCount)
            {
                Lobby.getInstance().CurrentFriendPage = 0;
            }

            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetFriendSummary(UpdateFriendsUI);
        }
        break;

        case DialogBtn.RequestNextPage:
        {
            Lobby.getInstance().CurrentFriendPage++;
            if (Lobby.getInstance().CurrentFriendPage == Lobby.getInstance().FriendPageCount)
            {
                Lobby.getInstance().CurrentFriendPage = 0;
            }

            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetFriendSummary(UpdateRequestUI);
        }
        break;

        case DialogBtn.ViewFriend1:
        case DialogBtn.ViewFriend2:
        case DialogBtn.ViewFriend3:
        case DialogBtn.ViewFriend4:
        case DialogBtn.ViewFriend5:
        case DialogBtn.ViewFriend6:
        {
            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            int       idx  = Lobby.getInstance().CurrentFriendPage *Constants.PageItemCount + btnIndex - (int)DialogBtn.ViewFriend1;
            long      uId  = Lobby.getInstance().FriendIDArray.Data[idx];
            recp.GetProfile(uId, ShowPersonalInfoDlg);        //ShowPersonalInfoDlg
        }
        break;

        case DialogBtn.IngorFriend1:
        case DialogBtn.IngorFriend2:
        case DialogBtn.IngorFriend3:
        case DialogBtn.IngorFriend4:
        case DialogBtn.IngorFriend5:
        case DialogBtn.IngorFriend6:
        {
            int idx = Lobby.getInstance().CurrentFriendPage *Constants.PageItemCount + btnIndex - (int)DialogBtn.IngorFriend1;
            m_opId = Lobby.getInstance().FriendIDArray.Data[idx];

            DialogBase.Show("REQUEST IGNORE", "Are you sure to ingore the request?", IngoreFriend);
        }
        break;

        case DialogBtn.AcceptFriend1:
        case DialogBtn.AcceptFriend2:
        case DialogBtn.AcceptFriend3:
        case DialogBtn.AcceptFriend4:
        case DialogBtn.AcceptFriend5:
        case DialogBtn.AcceptFriend6:
        {
            int idx = Lobby.getInstance().CurrentFriendPage *Constants.PageItemCount + btnIndex - (int)DialogBtn.AcceptFriend1;
            m_opId = Lobby.getInstance().FriendIDArray.Data[idx];

            DialogBase.Show("REQUEST ACCEPT", "Are you sure to accept the request?", AcceptFriend);
        }
        break;

        case DialogBtn.ViewSearchResult:
        {
            Reception recp = GameObject.Find("Reception").GetComponent <Reception>();
            recp.GetProfile(Lobby.getInstance().CurrentSummaryList.Data[0].UserId, ShowPersonalInfoDlg);
        }
        break;

        default:
            break;
        }
    }