private void enterRoom_rsp(Msg msg) { GlobleTimer.Instance.removeUpdate(addTimer); GlobleTimer.Instance.addUpdate(addTimer); if (((Room.EnterRsp)msg.body).err_no == 0) { int tableId = ((Room.EnterRsp)msg.body).tab_id; if (tableId > 0) { //AlertMgr.Instance.showAlert(ALERT_TYPE.type1,"是否重连到桌子:"+ tableId+"的对局", delegate{ // ProtoReq.ReJoinTable(tableId); //}); QuickTips.ShowQuickTipsNor("重连到桌子:" + tableId + "的对局"); ProtoReq.ReJoinTable(tableId); } else { //HallPanel.Instance.load(); } } //RoomController.Instance.enteredRoom((Room.EnterRsp)msg.body); else { //HallPanel.Instance.load(); } }
private void addClick() { _zjClose.onClick.AddListener(delegate { //DestoryPanel(); ClosePanel(); }); _jlClose.onClick.AddListener(delegate { _zhanji.gameObject.SetActive(true); _jilu.gameObject.SetActive(false); }); _xqClose.onClick.AddListener(delegate { _xiangqing.gameObject.SetActive(false); _jilu.gameObject.SetActive(true); }); _before.onClick.AddListener(delegate { if (_curPage > 1) { _curPage -= 1; ProtoReq.historyTableReq(_curPage); } }); _after.onClick.AddListener(delegate { if (_curPage < _sumPage) { _curPage += 1; ProtoReq.historyTableReq(_curPage); } }); }
private void setPanel6() { _panel6.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.addAgent(int.Parse(_panel6.transform.FindChild("id").GetComponent <InputField>().text).IdEx(), _panel6.transform.FindChild("Toggle").GetComponent <Toggle>().isOn); }); }
private void setPanel() { _panel.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.GMQuerySinglePlayer(int.Parse(_panel.transform.FindChild("id").GetComponent <InputField>().text).IdEx()); }); }
private void setPanel4() { _panel4.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.GMQuerySingleGMLog(int.Parse(_panel4.transform.FindChild("index").GetComponent <InputField>().text)); }); }
private void setPanel5() { _panel5.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.addCoin(int.Parse(_panel5.transform.FindChild("id").GetComponent <InputField>().text).IdEx(), int.Parse(_panel5.transform.FindChild("coin").GetComponent <InputField>().text)); }); }
private void setPanel2() { _panel2.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.GMQueryCoinPlayer(int.Parse(_panel2.transform.FindChild("coin").GetComponent <InputField>().text)); }); }
public static void InitUIRoot() { GameObject rootCanvas = ResourceManager.GetGameObject(URLConst.GetUI("UIRoot")); Transform canvas = rootCanvas.transform.FindChild("UICanvas"); GameObject tips = rootCanvas.transform.FindChild("TipsLayer").gameObject; QuickTips.InitQuickTipsLayer(tips, 100); GameConst.auto = rootCanvas.transform.FindChild("auto").gameObject; UIEventHandlerBase.AddListener(GameConst.auto, UIEventType.ON_POINTER_CLICK, delegate(GameObject obj, BaseEventData evn) { ProtoReq.cancelAuto(); }); GameConst.auto.SetActive(false); AlertMgr.Instance.Init(rootCanvas.transform.FindChild("Alert").gameObject); AlertMgr.Instance._alert.SetActive(false); rootCanvas.SetActive(true); rootCanvas.transform.localScale = Vector3.one; GameObject.DontDestroyOnLoad(rootCanvas); GameObject eventSystem = GameObject.Find("EventSystem"); if (eventSystem == null) { eventSystem = new GameObject("EventSystem"); eventSystem.AddComponent <EventSystem>(); eventSystem.AddComponent <StandaloneInputModule>(); eventSystem.AddComponent <TouchInputModule>(); } GameObject.DontDestroyOnLoad(eventSystem); }
public void LoginBack(Login.LoginRsp login) { if (login.usertype != 0) { if (login.usertype == 2) { GameConst.isDaili = false; GameConst.isGM = true; } else if (login.usertype == 1) { GameConst.isGM = false; GameConst.isDaili = true; } } MainRole.Instance.Id = login.id; //MainRole.Instance.Name = login.name DataMgr.Instance.money = login.money; Debug.Log("id" + login.id); //QuickTips.ShowGreenQuickTips("登录成功"); ProtoReq.EnterRoom(); HallPanel.Instance.load(); if (login.extmoney > 0) { //QuickTips.ShowBlueQuickTips("登录奖励钻石:" + login.extmoney); AlertMgr.Instance.showAlert(ALERT_TYPE.type2, "登录奖励钻石:" + login.extmoney); } //HallPanel.Instance.load(); }
private void buyOver(string result) { if (result.Equals("1")) { ProtoReq.purchaseReq(buyType); } }
public void createdTable(Table.CreateRsp create) { Debug.Log("桌子号" + create.tab_id); GameConst.tableId = create.tab_id; // RoomPanel.Instance.load(); ProtoReq.JoinTable(create.tab_id); }
private void setPanel7() { _panel7.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.GMDesRoom(int.Parse(_panel7.transform.FindChild("id").GetComponent <InputField>().text)); }); }
private void login() { //QuickTips.ShowRedQuickTips("消息"); //HallPanel.Instance.load(); if (!_toggle.isOn) { QuickTips.ShowQuickTipsNor("请同意用户协议"); return; } #if !UNITY_EDITOR if (GameConst.isGuest) { ProtoReq.LoginReq(GameConst.isGuest, _accInput.text.ToZhuan(), _accInput.text.ToZhuan(), 0, "htttp://test", _nameInput.text); } else { //SDKMgr.Instance.GetUserInfo();Authorize SDKMgr.Instance.GetUserInfo(); } #else if (string.IsNullOrEmpty(_accInput.text) || string.IsNullOrEmpty(_nameInput.text)) { QuickTips.ShowQuickTipsNor("输入有误"); } else { ProtoReq.LoginReq(GameConst.isGuest, _accInput.text.ToZhuan(), _nameInput.text, 0, "htttp://test"); } #endif }
public override void startUp(object obj = null) { base.startUp(obj); _num.text = "代理员当前钻石总数量为:" + DataMgr.Instance.money; index = 0; page = 0; ProtoReq.GMQueryMoneyLog(MainRole.Instance.Id, true); }
private void addTimer(float dt) { time += dt; if (time > 5) { ProtoReq.heartReq(); time = 0; } }
private void logining() { ProtoReq.CheckVersion(GameConfig.programVersion, GameConfig.OsName); Debug.LogError("收到链接返回"); if (_isWx) { //SDKMgr.Instance.GetUserInfo(); //updateUserInfo(PlayerPrefs.GetString("openId"), "", PlayerPrefs.GetString("nickName"), PlayerPrefs.GetInt("sex"), PlayerPrefs.GetString("url")); } }
public override void startUp(object obj = null) { base.startUp(obj); _zhanji.gameObject.SetActive(true); _jilu.gameObject.SetActive(false); _xiangqing.gameObject.SetActive(false); _zjInfo.gameObject.SetActive(false); _zjNone.gameObject.SetActive(true); ProtoReq.historyTableReq(_curPage); }
private void startVoteRsp(Msg msg) { Table.StartVoteRsp rsp = (Table.StartVoteRsp)(msg.body); AlertMgr.Instance.showAlert(ALERT_TYPE.type1, RoleController.Instance.getPlayerById(rsp.id).Name + "发起解散房间,是否同意", delegate { GameConst.VoteTimer = Time.time; ProtoReq.voteQuitReq(true); }, delegate { GameConst.VoteTimer = Time.time; ProtoReq.voteQuitReq(false); }, 15); }
private void updateUserInfo(string openId, string unionId, string nickName, int sex, string imageUrl) { Debug.LogError("收到微信,准备登录服务器"); PlayerPrefs.SetString("openId", openId); MainRole.Instance.Name = nickName; string imageUrlAfter = ""; if (!string.IsNullOrEmpty(imageUrl)) { imageUrlAfter = imageUrl.Substring(0, imageUrl.Length - 1) + "46"; } ProtoReq.LoginReq(GameConst.isGuest, openId, nickName, sex, imageUrlAfter); }
public override void OnInspectorGUI() { debug = (DebugInspector)target; base.OnInspectorGUI(); GUILayout.BeginHorizontal(); GUILayout.Label("查询ID", GUILayout.Width(80)); debug.cxID = int.Parse(GUILayout.TextField(debug.cxID.ToString())); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("查询")) { //debug.info = "查询"; ProtoReq.findUser(debug.cxID); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label("ID", GUILayout.Width(40)); debug.coinID = int.Parse(GUILayout.TextField(debug.coinID.ToString(), GUILayout.Width(100))); GUILayout.Label("金币数:", GUILayout.Width(40)); debug.coinAdd = int.Parse(GUILayout.TextField(debug.coinAdd.ToString(), GUILayout.Width(100))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("添加")) { ProtoReq.addCoin(debug.coinID, debug.coinAdd); //debug.info = "添加"; } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); if (GUILayout.Button("查看当前玩家数")) { ProtoReq.findPlayer(); //debug.info = "查看当前玩家数"; } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.TextArea(debug.info, GUILayout.Height(100)); GUILayout.EndHorizontal(); }
private void addClick() { _close.onClick.AddListener(delegate { ClosePanel(); }); _confirm.onClick.AddListener(delegate { if (_idInput.text.Equals("")) { QuickTips.ShowRedQuickTips("请输入玩家id"); return; } ProtoReq.GMQuerySinglePlayer(int.Parse(_idInput.text).IdEx()); }); _set.onClick.AddListener(delegate { if (_idInput.text.Equals("")) { QuickTips.ShowRedQuickTips("请输入玩家id"); return; } if (int.Parse(_coinInput.text) > DataMgr.Instance.money) { _warning.SetActive(true); return; } _warning.SetActive(false); ProtoReq.addCoin(int.Parse(_idInput.text).IdEx(), int.Parse(_coinInput.text)); _idInput.text = ""; }); _up.onClick.AddListener(delegate { if (index >= 6) { ProtoReq.GMQueryMoneyLog(MainRole.Instance.Id, true, index - 6); } page = -1; }); _down.onClick.AddListener(delegate { ProtoReq.GMQueryMoneyLog(MainRole.Instance.Id, true, index + 6); page = 1; }); }
private void onHistory() { if (HistoryController.Instance.tableList == null || HistoryController.Instance.tableList.Count == 0) { _zjInfo.SetActive(false); _zjNone.SetActive(true); } else { _zjInfo.SetActive(true); _zjNone.SetActive(false); _curPage = HistoryController.Instance.page; _sumPage = HistoryController.Instance.sumPage; _page.text = _curPage + "/" + _sumPage; _zjGrid.destoryChild(true); for (int i = 0; i < HistoryController.Instance.tableList.Count; i++) { GameObject obj = GameObject.Instantiate(_zjItem, _zjItem.transform.parent, true) as GameObject; obj.transform.localScale = Vector3.one; obj.transform.parent = _zjItem.transform.parent; obj.name = HistoryController.Instance.tableList[i].index.ToString(); obj.SetActive(true); obj.transform.FindChild("button").GetComponent <Button>().onClick.AddListener(delegate { ProtoReq.historyDetailReq(int.Parse(obj.name)); }); obj.transform.FindChild("roomNum").GetComponent <Text>().text = "房间号:" + HistoryController.Instance.tableList[i].table_id; obj.transform.FindChild("date").GetComponent <Text>().text = "日期:" + HistoryController.Instance.tableList[i].start_time; IconMgr.Instance.SetImage(obj.transform.FindChild("index").GetComponent <Image>(), "index" + (i + 1)); GameObject objInfo = obj.transform.FindChild("info").gameObject; for (int j = 0; j < HistoryController.Instance.tableList[i].playerinfo_list.Count; j++) { objInfo.transform.FindChild(j + "/name").GetComponent <Text>().text = HistoryController.Instance.tableList[i].playerinfo_list[j].name; objInfo.transform.FindChild(j + "/id").GetComponent <Text>().text = "【" + HistoryController.Instance.tableList[i].playerinfo_list[j].id.IdEx() + "】"; int score = HistoryController.Instance.tableList[i].playerinfo_list[j].total_score; if (score >= 0) { objInfo.transform.FindChild(j + "/score").GetComponent <Text>().text = "<color='#e83a1b'>+" + score + "</color>"; } else { objInfo.transform.FindChild(j + "/score").GetComponent <Text>().text = "<color='#825a48'>" + score + "</color>"; } } } } }
void OnApplicationFocus(bool hasFocus) { #if !UNITY_EDITOR if (!GameConst.isPlay) { return; } if (hasFocus) { ProtoReq.cancelAuto(); } else { ProtoReq.changeAuto(); } #endif }
private void addClick() { _jsclose.onClick.AddListener(delegate { //DestoryPanel(); ClosePanel(); RoleController.Instance.clear(); HallPanel.Instance.load(); SoundMgr._instance.bgmPlay("beijing_dating" + GameConst.BGM, GameConst.musicVol); }); _jsjixu.onClick.AddListener(delegate { //DestoryPanel(); ClosePanel(); RoleController.Instance.clear(); HallPanel.Instance.load(); SoundMgr._instance.bgmPlay("beijing_dating" + GameConst.BGM, GameConst.musicVol); }); _jsfenxiang.onClick.AddListener(delegate { if (!_isShare) { _isShare = true; GameConst.driver.StartCoroutine(CaptureScreen()); } }); _jsxiangqing.onClick.AddListener(delegate { ProtoReq.historyDetailReq(index); }); _jlClose.onClick.AddListener(delegate { _jiesuan.SetActive(true); _jilu.gameObject.SetActive(false); }); _xqClose.onClick.AddListener(delegate { _xiangqing.gameObject.SetActive(false); _jilu.gameObject.SetActive(true); }); }
public void joinedTable(Table.JoinRsp join) { Debug.Log("JoinRsp"); if (join.err_no == 0) { RoleController.Instance.clear(); GameConst.ower = join.owner; DataMgr.Instance.sumRound = join.rule.totalround; DataMgr.Instance.maxbet = join.rule.maxbet; DataMgr.Instance.jiangma = join.rule.jiangma; DataMgr.Instance.maima = join.rule.maima; ProtoReq.Ready(); for (int i = 0; i < join.roles.Count; i++) { RoleController.Instance.addPlayer(join.roles[i]); Debug.Log("role" + i + join.roles[i].name); } RoomPanel.Instance.load(); } else if (join.err_no == 1) { QuickTips.ShowQuickTipsNor("房间不存在"); } else if (join.err_no == 2) { QuickTips.ShowQuickTipsNor("人数已满"); } else if (join.err_no == 3) { QuickTips.ShowQuickTipsNor("已经在座位上,可能别处登录"); } else if (join.err_no == 4) { QuickTips.ShowQuickTipsNor("没有适合座位了"); } }
public override void InitPanel(Transform uiSprite) { base.InitPanel(uiSprite); _login = uiSprite.FindChild("login").GetComponent <Button>(); _zc = uiSprite.FindChild("zc").GetComponent <Button>(); _close = uiSprite.FindChild("CloseBtn").GetComponent <Button>(); _name = uiSprite.FindChild("name").GetComponent <InputField>(); _password = uiSprite.FindChild("password").GetComponent <InputField>(); _login.onClick.AddListener(delegate { if (string.IsNullOrEmpty(_name.text) || string.IsNullOrEmpty(_password.text)) { QuickTips.ShowQuickTipsNor("用户名或密码不能为空"); return; } ProtoReq.LoginReq(GameConst.isGuest, _name.text.ToZhuan(), _name.text.ToZhuan(), 0, "htttp://test", _password.text); //DestoryPanel(); ClosePanel(); }); _zc.onClick.AddListener(delegate { if (string.IsNullOrEmpty(_name.text) || string.IsNullOrEmpty(_password.text)) { QuickTips.ShowQuickTipsNor("用户名或密码不能为空"); return; } ProtoReq.zc(_name.text, _password.text); }); _close.onClick.AddListener(delegate { ClosePanel(); }); }
private void setPanel3() { _panel3.transform.FindChild("Button").GetComponent <Button>().onClick.AddListener(delegate { index = 0; ProtoReq.GMQueryMoneyLog(int.Parse(_panel3.transform.FindChild("id").GetComponent <InputField>().text).IdEx(), _panel3.transform.FindChild("Toggle").GetComponent <Toggle>().isOn); }); _up.onClick.AddListener(delegate { if (index >= 6) { ProtoReq.GMQueryMoneyLog(MainRole.Instance.Id, true, index - 6); } page = -1; }); _down.onClick.AddListener(delegate { ProtoReq.GMQueryMoneyLog(MainRole.Instance.Id, true, index + 6); page = 1; }); }
private void createTable() { ProtoReq.CreateTable(_playoffs, _times, _jiangma, _maima, "123"); }
private void joinTable(int id) { ProtoReq.JoinTable(id); }
public void rejoinTable(Table.ReJoinRsp reJoin) { if (reJoin.err_no == 0) { RoleController.Instance.clear(); GameConst.tableId = reJoin.tab_id; GameConst.ower = reJoin.owner; DataMgr.Instance.sumRound = reJoin.rule.totalround; DataMgr.Instance.maxbet = reJoin.rule.maxbet; DataMgr.Instance.jiangma = reJoin.rule.jiangma; DataMgr.Instance.maima = reJoin.rule.maima; if (reJoin.cur_id == MainRole.Instance.Id) { GameConst.isTurn = true; } else { GameConst.isTurn = false; } foreach (var item in reJoin.roles) { RoleController.Instance.addPlayer(item); } if (reJoin.is_playing == 1) { GameConst.curId = reJoin.cur_id; GameConst.curCard = reJoin.cur_card; GameConst.isPlay = true; DataMgr.Instance.reSet(); DataMgr.Instance.curRound = reJoin.cur_round; DataMgr.Instance.leftCardNum = reJoin.left_card; foreach (var item in reJoin.player_record) { if (DataMgr.Instance._showScore.ContainsKey(item.id)) { DataMgr.Instance._showScore[item.id] = item.total_score; } else { DataMgr.Instance._showScore.Add(item.id, item.total_score); } } foreach (var item in reJoin.end_cards) { if (item.id == MainRole.Instance.Id) { CardController.Instance.cleanUp(); bool flag = false; for (int i = 0; i < item.cards.Count; i++) { if (reJoin.cur_id == MainRole.Instance.Id) { if (reJoin.cur_card == item.cards[i] && !flag) { flag = true; continue; } } Card card = new Card(item.cards[i]); CardController.Instance.addCard(card.CardType, card.CardNum); } } else { switch (item.id.idToPos()) { case 1: DataMgr.Instance.rightCardNum = item.cards.Count; break; case 2: DataMgr.Instance.topCardNum = item.cards.Count; break; case 3: DataMgr.Instance.leftCardNum = item.cards.Count; break; } } for (int i = 0; i < item.outcards.Count; i++) { DataMgr.Instance._heCards[item.id.idToPos()].Add(item.outcards[i]); } for (int i = 0; i < item.pgdata.Count; i++) { if (item.pgdata[i].ptype == 0) { DataMgr.Instance._everyPeng[item.id.idToPos()].Add(item.pgdata[i].card, new PengData(item.id.idToPos(), item.pgdata[i].from.idToPos(), item.pgdata[i].card, null)); } else { if (item.pgdata[i].ptype == 3) { DataMgr.Instance._everyGang[item.id.idToPos()].Add(item.pgdata[i].card, new GangData(item.id.idToPos(), item.id.idToPos(), item.pgdata[i].card, true, null)); } else { DataMgr.Instance._everyGang[item.id.idToPos()].Add(item.pgdata[i].card, new GangData(item.id.idToPos(), item.pgdata[i].from.idToPos(), item.pgdata[i].card, false, null)); } } } } //EventDispatcher.Instance.Dispatch(GameEventConst.RECONNECT, true); RoomPanel.Instance.load(1); } else { if (reJoin.is_playing == 0) { ProtoReq.Ready(); } //EventDispatcher.Instance.Dispatch(GameEventConst.RECONNECT, false); RoomPanel.Instance.load(reJoin.err_no); } SoundMgr._instance.bgmPlay("beijing-fangjian" + GameConst.BGM, GameConst.musicVol); } }