public virtual void SetIsGameOver(bool isGameOver) { //设置按钮 if (isGameOver) { mIsGameOver = true; _startCall = null; } else { _startCall = () => { Hide(); EventDispatch.Dispatch((int)NetEventId.OnGameRestart, new EventData()); }; if (TotalBtn != null) { TotalBtn.gameObject.SetActive(false); if (BtGoOn != null) { BtGoOn.SetActive(true); } } } }
/// <summary> /// 倒序摸牌 /// </summary> /// <returns></returns> public MahjongItem RevPopMahjong() { int index = 0; var mayIndex = MahjongList.Count - 2; if (mayIndex >= 0 && MahjongList.Count % 2 == 0) { index = mayIndex; } else { index = MahjongList.Count - 1; } MahjongItem item = MahjongList[index]; MahjongList.RemoveAt(index); MahjongManager.Instance.Recycle(item); if (MahjongList.Count <= 0) { EventDispatch.Dispatch((int)GameEventId.RevWallMahjongFinish, new EventData()); } return(item); }
/// <summary> /// 配置GPS信息显示GPS界面,否则显示人物信息 /// </summary> public void OnUserHeadClick() { var apiInfo = new Dictionary <string, object>() { { "bundleID", Application.bundleIdentifier } }; Facade.Instance <TwManager>().SendAction("gpsOpen", apiInfo, msg => { if (msg == null) { return; } var dic = (Dictionary <string, object>)msg; object flag; if (dic.TryGetValue(("gpsOpen"), out flag)) { if (bool.Parse(flag.ToString())) { //显示GPS EventDispatch.Dispatch((int)UIEventId.ShowGPSInfo, new EventData()); } else { //显示表情 if (_seatID != -1) { EventDispatch.Dispatch((int)NetEventId.OnUserDetail, new EventData(_seatID)); } } } }); }
// Use this for initialization void Start() { UIEventListener.Get(mConnect.gameObject).onClick = (go) => { RequestConnect(); }; UIEventListener.Get(mReady.gameObject).onClick = (go) => { EventDispatch.Dispatch(EventID.Ready_Request, 0); }; UIEventListener.Get(mSkill1.gameObject).onClick = (go) => { ReleaseSkill(1); }; UIEventListener.Get(mSkill2.gameObject).onClick = (go) => { ReleaseSkill(2); }; UIEventListener.Get(mSkill3.gameObject).onClick = (go) => { ReleaseSkill(3); }; }
void LateUpdate() { EventPlayerMove.sData.roleid = roleid; EventPlayerMove.sData.position = position; EventDispatch.Dispatch(EventID.Player_Move, EventPlayerMove.sData); }
private void OnReadyBC(GM_Ready recvData) { Debug.Log("玩家准备,id=" + recvData.roleId); if (recvData == null) { return; } PlayerCharacter tmpPlayerCharacter = PlayerManager.GetSingleton().GetPlayerCharacter(recvData.roleId); if (tmpPlayerCharacter) { tmpPlayerCharacter.SetPosition(ProtoTransfer.Get(recvData.position)); tmpPlayerCharacter.SetRotation(ProtoTransfer.Get(recvData.direction)); tmpPlayerCharacter.SetReady(); } if (recvData.roleId == PlayerManager.GetSingleton().mRoleId) { PlayerManager.GetSingleton().mReady = true; } EventDispatch.Dispatch(EventID.Ready_Broadcast, recvData.roleId); }
private void OnBeginBC(GM_Begin recvData) { if (recvData.result == 0) { Debug.Log("Server frame begin"); mCurrentFrame = 1; mBegin = true; mFrameTime = 0; mTickThread = new Thread(Tick); mTickThread.Start(); EventDispatch.Dispatch(EventID.Begin_Broadcast, mBegin); CreateMonster(); } else { if (Debuger.ENABLELOG) { Debug.Log("Start result=" + recvData.result); } } }
protected override void OnGangGold(ISFSObject data) { //先判断是否是切猪头 if (data.ContainsKey("qzt")) { var goldsSfsObj = data.GetSFSObject("qzt"); var list = new List <int>(); foreach (var key in goldsSfsObj.GetKeys()) { list.Add(goldsSfsObj.GetInt(key)); } var len = list.Count; var glodList = new int[len]; for (int i = 0; i < len; i++) { int chair = GetChairId(i); glodList[chair] = list[i]; } EventDispatch.Dispatch((int)UIEventId.UserGlodChange, new EventData(glodList)); } else { base.OnGangGold(data); } }
public virtual void OnTingClick() { EventDispatch.Dispatch((int)NetEventId.OnTingClick, new EventData()); EventDispatch.Dispatch((int)UIEventId.LiangPaiTip, new EventData(1)); MenuBg.SetActive(false); CancelTrusteeship(); }
public override void OnGetInCard(ISFSObject data) { IsGetInBuZhangFinish = true; CurrSeat = data.GetInt(RequestKey.KeySeat); GetInMahJong(data); OnOperate(data); LeaveMahjongCnt--; //抓牌用户 听牌的 并且 当前无菜单提示 自动打牌 if (CurrSeat == PlayerSeat && IsTing[CurrSeat] && _switchGameOpreateMenu.IsForbiddenAll()) { OutCardDelayTimeIndex = DelayTimer.StartTimer( GameConfig.GetInCardRoteTime + GameConfig.GetInCardWaitTime + GameConfig.TingPaiWaitTime, () => EventDispatch.Dispatch((int)NetEventId.OnOutMahjong, new EventData(GetInMahjong))); } //自动打牌,抓啥打啥,仅测试用 if (CurrSeat == PlayerSeat && ziDongDaPai) { OutCardDelayTimeIndex = DelayTimer.StartTimer( GameConfig.GetInCardRoteTime + GameConfig.GetInCardWaitTime + GameConfig.TingPaiWaitTime, () => EventDispatch.Dispatch((int)NetEventId.OnOutMahjong, new EventData(GetInMahjong))); } //---------------------------*/ BuZhangGetInSeat = UtilDef.NullSeat; }
private void SetCardValues() { for (int i = 0; i < _cardValues.Count; i++) { GameObject mj = D2MahjongMng.Instance.GetMj(_cardValues[i], EnD2MjType.Me); var img = mj.GetComponent <Image>(); if (img != null) { img.raycastTarget = true; } var mjRTF = mj.GetComponent <RectTransform>(); mjRTF.SetParent(Parent); mjRTF.localScale = Vector3.one; mjRTF.localPosition = Vector3.zero; var clickEvent = new Button.ButtonClickedEvent(); var cardValue = _cardValues[i]; clickEvent.AddListener(() => { EventDispatch.Dispatch((int)NetEventId.GetNeedCard, new EventData(cardValue)); Hide(); }); var mjBtn = mj.AddComponent <Button>(); mjBtn.onClick = clickEvent; } }
//void Start() //{ // //if (null != GameAdpaterManager.Singleton) // //{ // // GetComponent<RectTransform>().anchoredPosition3D = GameAdpaterManager.Singleton.GetConfig.ChooseCpPnl_Pos; // //} //} public virtual void OnCancelClick() { Reset(); CancelCall(); CancelCall = null; EventDispatch.Dispatch((int)UIEventId.RedisplayButtons); }
protected virtual void OnPress(bool isPress) { if (!UtilData.HandMjTouchEnable) { return; } #if UNITY_ANDROID || UNITY_IPHONE if (UiItemSelect != null) { UiItemSelect(gameObject, isPress); } if (EnableEvent && EnableSelectEvent && ItemSelect != null) { ItemSelect(gameObject, isPress); } #endif if (isPress == false) { //麻将结束拖拽 if (_dragClone != null) { //判断是否拖拽有效 if (_dragClone.transform.position.y - mRecordMahjongPos.y >= FDragMinDis) { //拖拽有效 出牌 if (OnThrowOut != null) { OnThrowOut(transform); } else { YxDebug.Log("no response call"); } if (mHideMahjongOnDrag) { transform.position = mRecordMahjongPos; } } else { if (mHideMahjongOnDrag) { transform.position = mRecordMahjongPos; } } MahjongManager.Instance.RecycleCloneMahjong(_dragClone); _dragClone = null; #if UNITY_ANDROID || UNITY_IPHONE if (_selectTransform != null) { _selectTransform.GetComponent <MouseRoll>().RollDown(); } _selectTransform = null; #endif EventDispatch.Dispatch((int)GameEventId.CleareFlagMahjong, new EventData(GameEventId.CleareFlagMahjong)); } } }
protected virtual void OnChooseTing(EventData evn) { GetChooseCgPnl().SetChooseTing(); GetChooseCgPnl().CancelCall = () => { GetOpreateMenu().ShowMenuBg(); EventDispatch.Dispatch((int)GameEventId.ChooseTingCancel); }; }
public void OnCancelTrusteeshipClick(GameObject go) { go.SetActive(false); if (Trusteeship != null) { Trusteeship.SetActive(true); } EventDispatch.Dispatch((int)EventID.GameEventId.OnCancelTrusteeship); }
public override int SetUserInfo(ISFSObject data) { JustCheckShowTaihuainfoOnreJoin(data); //return base.SetUserInfo(data); UserData user = new UserData(); user.ParseData(data); //如果当前用户不是空的 只更新用户信息不处理事件 if (UserDatas[user.Seat].IsNull == false) { //重新赋值用户信息 UserDatas[user.Seat] = user; return(UserDatas[user.Seat].Seat); } UserDatas[user.Seat] = user; EventDispatch.Dispatch((int)UIEventId.GetIpAndCountry, new EventData(GetChairId(user.Seat), user.ip, user.Country)); if (RoomInfo.RoomType == EnRoomType.YuLe) { if (user.Seat == PlayerSeat && user.IsReady == false) { EventDispatch.Dispatch((int)NetEventId.OnUserReady, new EventData()); } GameReadyBtn.SetActive(false); } else { if (user.Seat == PlayerSeat) { //如果是当前用户并且没有准被 发送准备消息 GameReadyBtn.SetActive(user.IsReady == false); } } /* if (user.Seat == PlayerSeat && user.IsReady == false) * { * EventDispatch.Dispatch((int)NetEventId.OnUserReady, new EventData()); * }*/ bool isAllReady = IsAllReady(); //如果全部准备了 发送准备消息 if (isAllReady && !_isReconect) { App.GameData.GStatus = YxEGameStatus.Play; EventDispatch.Dispatch((int)UIEventId.GameStart, new EventData()); } //设置声音的性别 SoundManager.Instance.SetSex(GetChairId(user.Seat), UserDatas[user.Seat].Sex); return(user.Seat); }
private void TrusteeshipContorl(bool isOn) { mIsTrusteeship = isOn; EventDispatch.Dispatch((int)GameEventId.OnTrusteeship, new EventData() { data1 = mIsTrusteeship }); DisableTrusteeshipBtn.gameObject.SetActive(mIsTrusteeship); }
public void SendChat() { if (Input.text.Length > 0) { EventDispatch.Dispatch((int)NetEventId.OnUserTalk, new EventData(EnChatType.text, Input.text)); Input.text = ""; Input.GetComponent <InputField>().text = ""; Hide(); } }
//每列最后阶段倒数几轮的滚动 protected override void MoveLineIconInEnd(int num, int line) { if (EndRollNums[num] > 4) { for (int j = 0; j < AllChild[num].Count; j++) { if (AllChild[num][j].GetComponent <MoveJettonIcon>().Move(Speeds[line] * Time.deltaTime * _speedTimes)) { EndRollNums[num]--; ResetJettonPos(num); ChangeJettonOrder(AllChild[num]); } } } else if (EndRollNums[num] >= 1 && EndRollNums[num] <= 4) { for (int j = 0; j < AllChild[num].Count; j++) { if (AllChild[num][j].GetComponent <MoveJettonIcon>().Move(Speeds[line] * Time.deltaTime * _speedTimes)) { EndRollNums[num]--; ResetJettonPos(num); if (EndRollNums[num] != 0) { if (IsHaveDan && line == DanLine && EndRollNums[num] == DanRow) { var _response = App.GetGameData <OverallData>().Response; NameInDan = _response.GetJettonName(SpriteName); AllChild[num][0].GetComponent <UISprite>().spriteName = SpriteName + "dan";//这个图片的顺序是从下到上从左到右一列一列显示的 } else { var _response = App.GetGameData <OverallData>().Response; AllChild[num][0].GetComponent <UISprite>().spriteName = _response.GetJettonName(SpriteName); } Facade.Instance <MusicManager>().Play("stopcard"); } else { ChangeJettonOrder(AllChild[num]); if (num == HoldTimes.Length - 1) { EventDispatch.Dispatch((int)EventID.GameEventId.WhenIconStop); if (NeedPlayDan) { EventDispatch.Dispatch((int)EventID.GameEventId.PlayZaDanEffect, new EventData(NameInDan)); } InitData(); } } } } } }
public void OnExistRoomForSure() { //CloseXiaLa(); YxMessageBox.Show("是否要解散房间?", null, (box, btnName) => { if (btnName.Equals(YxMessageBox.BtnLeft)) { EventDispatch.Dispatch((int)NetEventId.OnDismissRoom, new EventData(EnDismissFeedBack.ApplyFor)); } }, false, YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle); }
protected virtual void CancelTrusteeship() { if (TrusteeshipHelper.Instance != null) { if (TrusteeshipHelper.Instance.IsTrusteeship) { EventDispatch.Dispatch((int)UIEventId.DisableTrusteeship); } TrusteeshipHelper.Instance.IsAllowTrusteeship = false; } }
public void ResetPos() { _dv = Nothing; Vector3 v3 = Target.localPosition; v3.y = Situ; Target.localPosition = v3; EventDispatch.Dispatch((int)GameEventId.CleareFlagMahjong, new EventData()); }
public override void StopRoll() { StopRollJettonNow(); EventDispatch.Dispatch((int)EventID.GameEventId.WhenIconStop); //如果需要砸蛋,则播放砸蛋特效 if (NeedPlayDan) { EventDispatch.Dispatch((int)EventID.GameEventId.PlayZaDanEffect, new EventData(NameInDan)); } InitData(); }
//托管 public virtual void OnTrusteeshipClick() { if (IsAllowTrusteeship) { if (mIsTrusteeship) { return; } TrusteeshipContorl(true); EventDispatch.Dispatch((int)UIEventId.FgConfirmgBtnCtrl, new EventData(false)); } }
public override void GetGangData(ISFSObject obj, DVoidSfsObject sendCall) { List <FindGangData> findList = FindCanGang(); //如果不能杠财神,则移除可能是财神的牌 if (_cargs2.ContainsKey(Gangcaishen) && _cargs2.GetUtfString(Gangcaishen) == "0") { foreach (var findGangData in findList) { if (findGangData.cards[0] == Laizi) { findList.Remove(findGangData); break; } } } DVoidInt sendCallArray = index => { YxDebug.Log("发送服务器 杠 " + findList[index].cards); if (findList[index].type != UtilDef.DefInt) { obj.PutInt(RequestKey.KeyType, findList[index].type); } if (findList[index].ttype != UtilDef.DefInt) { obj.PutInt(RequestKeyOther.KeyTType, findList[index].ttype); } if (findList[index].cards != null && findList[index].ttype != MjRequestData.CPG_ZhuaGang) { obj.PutIntArray(RequestKey.KeyCards, findList[index].cards); } else if (findList[index].cards != null && findList[index].ttype == MjRequestData.CPG_ZhuaGang) { obj.PutInt(RequestKey.KeyOpCard, findList[index].cards[0]); } sendCall(obj); }; //如果找到的杠 大于1 if (findList.Count > 1) { YxDebug.Log("通知UI 提示杠选择 " + findList.Count); var lisiCard = findList.Select(t => t.cards).ToList(); //通知UI提示选择 EventDispatch.Dispatch((int)UIEventId.CgChoose, new EventData(lisiCard, sendCallArray, _outPutMahjong)); } else { sendCallArray(0); } }
public void OnChangeRoomClick() { CloseXiaLa(); if (App.GameData.GStatus != YxEGameStatus.Normal) { YxMessageBox.Show("游戏中不能换房间!"); } else { EventDispatch.Dispatch((int)NetEventId.OnChangeRoom); } }
protected override void OutCard(MahjongItem chooseMj) { int value = chooseMj.Value; //通知网络 发送出牌消息 EventDispatch.Dispatch((int)NetEventId.OnOutMahjong, new EventData(value)); //如果打出的牌是抬起状态放下 if (chooseMj.Roll != null && chooseMj.Roll.IsUp) { chooseMj.Roll.ResetPos(); } }
public void OnRefuseBtn() { YxDebug.Log("拒绝解散"); setBtnsActive(false); if (_isApply[_allUserName[0]] != EnDismissFeedBack.None) { return; } //发送解散拒绝 EventDispatch.Dispatch((int)NetEventId.OnDismissRoom, new EventData(EnDismissFeedBack.Refuse)); }
public void ZiDongDaPai(Text text) { zidongdapai_bool = !zidongdapai_bool; if (zidongdapai_bool) { text.text = "取消自动"; } else { text.text = "自动打牌"; } EventDispatch.Dispatch((int)NetEventId.OnZiDongDaPai, new EventData()); }
private void OnPingReturn(GM_Return recvData) { if (recvData == null) { return; } long interval = DateTime.Now.Ticks - mPingTime; TimeSpan span = new TimeSpan(interval); int ping = span.Milliseconds / 2; EventDispatch.Dispatch(EventID.Ping_Broadcast, ping); }