public void ChuPai(int playerId, MJType type) { AudioManager.Play(Tags.Audio_Name.DaPai); if (IsCanControl) { int index = DataCenter.Instance.players[playerId].MJ_IN_List.IndexOf(type); DataCenter.Instance.gamedata.IsChuPaing = false; if (index >= 0) { Debuger.Log("ControlCenter ChuPai ! " + type + " " + playerId); PlaySound_MJ(type); DataCenter.Instance.players[playerId].MJ_OUT_List.Add(type); DataCenter.Instance.players[playerId].MJ_IN_List.RemoveAt(index); //DataCenter.Instance.players[playerId].MJ_IN_List.Add((MJType)(RandomMgr.Range((int)MJType.万_1, (int)MJType.MJ_白板))); } else { Debuger.LogError("ControlCenter ChuPai Error ! " + type + " " + playerId); } } else { PlaySound_MJ(type); DataCenter.Instance.players[playerId].MJ_OUT_List.Add(type); DataCenter.Instance.players[playerId].MJ_IN_List.RemoveAt(0); } DataCenter.Instance.players[playerId].SortMJ(); ReflushPlayerPanel(playerId); ShowCurChuPai(playerId); //GetPlayerPanel(playerId).SetCanDragMJ(false); ViewCenter.Instance.GetPanel <Panel_Player_Bottom>(PanelType.Player_BOTTOM).HideAllBtnResult(); TimeDown.Instance.StopDownTime(); }
public void ShowChuPai(SEAT_DIR dir, MJType type) { sprite_ChuPai.gameObject.SetActive(true); sprite_ChuPai.spriteName = type.ToString() + "_MINE"; Vector3 pos = Vector3.zero; switch (dir) { case SEAT_DIR.DIR_LEFT: pos = new Vector3(-370, 0, 0); break; case SEAT_DIR.DIR_BOTTOM: pos = new Vector3(0, -150, 0); break; case SEAT_DIR.DIR_RIGHT: pos = new Vector3(370, 0, 0); break; case SEAT_DIR.DIR_TOP: pos = new Vector3(0, 230, 0); break; default: break; } sprite_ChuPai.transform.localPosition = pos; CancelInvoke("HideChuPai"); Invoke("HideChuPai", 0.7f); }
public string GetSpriteName(MJType type, int playerId, MJ_STAGE stage, bool bBack) { SEAT_DIR dir = GameGD.GetSeatDir(playerId); string spriteName = GetSpriteName(type, dir, stage, bBack); return(spriteName); }
public void GoToNextPlate() { huTypeList.Clear(); fangPaoDir = DNXB_DIR.Null; huPaiMJType = MJType.Null; ZhongYuList.Clear(); ZhongYuOKList.Clear(); }
private MJ AddMJ(int playerId, MJType type, MJ_STAGE stage, bool bBack = false) { MJ mj = _MJ_Mgr.SpawnMJ(transform, type, playerId, stage, bBack, null); mj.transform.parent = transform; return(mj); }
private void PlaySound_MJ(MJType type) { string audioClipName = ""; string sex = ""; if (DataCenter.Instance.gamedata.playerInfo.sex == SEX.Boy) { sex += "Boy_"; } else { sex += "Girl_"; } if (type >= MJType.万_1 && type <= MJType.万_9) { audioClipName += "Wan_" + sex + (int)(type - MJType.万_1 + 1); } else if (type >= MJType.条_1 && type <= MJType.条_9) { audioClipName += "Tiao_" + sex + (int)(type - MJType.条_1 + 1); } else if (type >= MJType.筒_1 && type <= MJType.筒_9) { audioClipName += "Tong_" + sex + (int)(type - MJType.筒_1 + 1); } else if (type == MJType.MJ_东) { audioClipName += "Feng_" + sex + "东"; } else if (type == MJType.MJ_南) { audioClipName += "Feng_" + sex + "南"; } else if (type == MJType.MJ_西) { audioClipName += "Feng_" + sex + "西"; } else if (type == MJType.MJ_北) { audioClipName += "Feng_" + sex + "北"; } else if (type == MJType.MJ_红中) { audioClipName += "Feng_" + sex + "中"; } else if (type == MJType.MJ_发) { audioClipName += "Feng_" + sex + "发"; } else if (type == MJType.MJ_白板) { audioClipName += "Feng_" + sex + "白"; } AudioManager.Play(audioClipName); }
private MJ AddMJ(int playerId, MJType type, MJ_STAGE stage, bool bBack = false) { MJ mj = _MJ_Mgr.SpawnMJ(transform, type, playerId, stage, bBack, null); mj.Depth = 2000; mj.transform.parent = transform; MJList.Add(mj); //NGUITools.SetDirty(mj); return(mj); }
public List <MJType> ZhongYuOKList = new List <MJType>(); //中鱼 public bool IsZhongYu(MJType type) { for (int i = 0; i < ZhongYuOKList.Count; i++) { if (ZhongYuOKList[i] == type) { return(true); } } return(false); }
public MJ SpawnMJ(Transform parent, MJType type, int playerId, MJ_STAGE stage, bool bBack, Panel_Player playerPanel) { Transform ts = pool.Spawn(prefab, pool.transform); ts.transform.localScale = Vector3.one; MJ mj = ts.GetComponent <MJ>(); mj.Init(type, stage, playerId, playerPanel); int w = 0, h = 0; GetSpriteWH(ref w, ref h, playerId, stage); mj.InitSprite(GetSpriteName(type, playerId, stage, bBack), w, h); return(mj); }
public void MoPai(MJType type) { //if (type>0) { cannotChuMJList.Clear(); AddMJ_IN_Data(new List <MJType> { type }, false); ControlCenter.Instance.SetCurChuPaiDir(playerInfo.DNXBDir); if (ControlCenter.Instance.IsCanControl) { Debuger.Log("MoPai: " + type); } } }
private int SortFunc(MJType x, MJType y) { if (x > y) { return(1); } else if (x == y) { return(0); } else { return(-1); } }
//设置不能选择麻将 public void SetCannotSelect(MJType type) { for (int i = 0; i < MJ_IN_List.Count; i++) { if (MJ_IN_List[i].type == type) { MJ_IN_List[i].SetColor(new Color(0.3f, 0.3f, 0.3f)); MJ_Drag md = MJ_IN_List[i].GetComponent <MJ_Drag>(); if (md) { md.enabled = false; } } } }
public void ChuPai(MJ mj) { if (!IsChuPaing) { return; } MJType type = mj.type; int playerId = mj.PlayerID; if (GD.SIMULATE_CHUPAI) { ChuPai(playerId, type); GameApp.Instance.GoToNextPlayer(); } Debuger.Log("ControlCenter ChuPai ! " + type + " " + playerId); DealCommand.Instance.SendChuPai(type); }
public void ShowResultMJ(List <Result_Struct> data, ResultType type) { DespawnAllResultMJ(); int count = 0; for (int i = 0; i < data.Count; i++) { if (data[i].type == type) { for (int j = 0; j < data[i].MJList.Count; j++) { MJ mj = AddMJ(data[i].MJList[j], MJ_STAGE.CPGResult); int index = i; if (type == ResultType.吃) { UIEventListener.Get(mj.gameObject).onClick += delegate { ControlCenter.Instance.Btn_Result_OnClick_Send(type, index); DespawnAllResultMJ(); }; } else if (type == ResultType.暗杠) { MJType mjType = data[i].MJList[0]; UIEventListener.Get(mj.gameObject).onClick += delegate { ControlCenter.Instance.Btn_Result_OnClick_Send(type, -1, mjType); DespawnAllResultMJ(); }; } Vector3 pos = Vector3.zero; mj.transform.parent = ResultMJMgrTrans; mj.transform.localPosition = new Vector3(count * (GameGD.MJ_BOTTOM_CPG_RESULT_W - 2) + i * 20, 0); ResultMJList.Add(mj); count++; } } } }
public void Init(MJType type, MJ_STAGE stage, int playerId, Panel_Player playerPanel) { mTrans = this.transform; SetType(type); this.stage = stage; PlayerID = playerId; Depth = 0; this.playerPanel = playerPanel; sprite.color = Color.white; GetComponent <BoxCollider>().enabled = false; if ((stage == MJ_STAGE.IN || stage == MJ_STAGE.CPGResult) && !DataCenter.Instance.hFdata.IsHuiFanging) { GetComponent <BoxCollider>().enabled = true; } //ShowArrow(false); MJ_Drag md = GetComponent <MJ_Drag>(); if (md) { md.enabled = false; } }
/// <summary> /// 添加麻将 /// </summary> /// <param name="type">麻将类型</param> /// <param name="stage"> 是否是手中的麻将 </param> /// <returns></returns> protected virtual MJ AddMJ(MJType type, MJ_STAGE stage, bool bBack = false) { MJ mj = _MJMgr.SpawnMJ(transform, type, data.playerId, stage, bBack, this); switch (stage) { case MJ_STAGE.IN: MJ_IN_List.Add(mj); break; case MJ_STAGE.OUT: MJ_OUT_List.Add(mj); break; case MJ_STAGE.CPG: MJ_CPG_List.Add(mj); break; default: break; } return(mj); }
protected override MJ AddMJ(MJType type, MJ_STAGE stage, bool bBack = false) { MJ mj = base.AddMJ(type, stage, bBack); int playerId = DataCenter.Instance.gamedata.PlayerID; if (stage == MJ_STAGE.IN && ControlCenter.Instance.IsChuPaing ) { bool bCanSelect = true; for (int i = 0; i < DataCenter.Instance.players[playerId].cannotChuMJList.Count; i++) { if (type == DataCenter.Instance.players[playerId].cannotChuMJList[i]) { bCanSelect = false; break; } } if (bCanSelect) { if (!DataCenter.Instance.hFdata.IsHuiFanging) { MJ_Drag md = mj.GetComponent <MJ_Drag>(); if (md) { md.enabled = true; } } } else { mj.SetColor(new Color(0.3f, 0.3f, 0.3f)); } } return(mj); }
private void SetType(MJType type) { this.type = type; }
/// <summary> /// /// </summary> /// <param name="type">麻将类型</param> /// <param name="seatDir">方位</param> /// <param name="bIN">是否为手中的麻将</param> /// <param name="bBack">背面</param> /// <returns></returns> private string GetSpriteName(MJType type, SEAT_DIR seatDir, MJ_STAGE stage, bool bBack) { string spriteName = ""; switch (seatDir) { case SEAT_DIR.DIR_LEFT: { if (stage == MJ_STAGE.IN && !DataCenter.Instance.hFdata.IsHuiFanging) { spriteName = Tags.MJ_SpriteName_L; } else { spriteName = type.ToString() + "_L"; } if (bBack) { spriteName = Tags.MJ_SpriteName_Back_L; } } break; case SEAT_DIR.DIR_BOTTOM: { if (stage == MJ_STAGE.IN) { spriteName = type.ToString() + "_MINE"; } else { spriteName = type.ToString() + "_B"; } if (bBack) { spriteName = Tags.MJ_SpriteName_Back_B; } } break; case SEAT_DIR.DIR_RIGHT: { if (stage == MJ_STAGE.IN && !DataCenter.Instance.hFdata.IsHuiFanging) { spriteName = Tags.MJ_SpriteName_R; } else { spriteName = type.ToString() + "_R"; } if (bBack) { spriteName = Tags.MJ_SpriteName_Back_R; } } break; case SEAT_DIR.DIR_TOP: { if (stage == MJ_STAGE.IN && !DataCenter.Instance.hFdata.IsHuiFanging) { spriteName = Tags.MJ_SpriteName_T; } else { spriteName = type.ToString() + "_B"; } if (bBack) { spriteName = Tags.MJ_SpriteName_Back_T; } } break; default: break; } return(spriteName); }
public void AddCannotChuMJ(MJType type) { cannotChuMJList.Add(type); }
public void Btn_Result_OnClick_Send(ResultType type, int ChiIndex = -1, MJType AnGangMJ = MJType.Null) { int playerId = DataCenter.Instance.gamedata.PlayerID; List <Result_Struct> resultList = DataCenter.Instance.players[playerId].resultList; if (type == ResultType.吃) { if (ChiIndex == -1) { ChiIndex = FindResultIndex(resultList, type); } resultList[ChiIndex].MJList.Remove(DataCenter.Instance.gamedata.CurChuMJ.type); DealCommand.Instance.SendCPGH(type, resultList[ChiIndex].MJList, MJType.Null); DataCenter.Instance.players[playerId].AddCannotChuMJ(DataCenter.Instance.gamedata.CurChuMJ.type); //GetPlayerPanel(DataCenter.Instance.gamedata.PlayerID).SetCannotSelect(DataCenter.Instance.gamedata.CurChuMJ.type); } else if (type == ResultType.暗杠) { if (AnGangMJ == MJType.Null) { int index = FindResultIndex(resultList, type); AnGangMJ = resultList[index].MJList[0]; } DealCommand.Instance.SendCPGH(type, null, AnGangMJ); } else { DealCommand.Instance.SendCPGH(type); } TimeDown.Instance.StartDownTime(); ViewCenter.Instance.GetPanel <Panel_Player_Bottom>(PanelType.Player_BOTTOM).HideAllBtnResult(); PlaySound_Result(type, DataCenter.Instance.gamedata.playerInfo.sex); if (type != ResultType.过) { SetCurChuPaiDir(DataCenter.Instance.gamedata.SelfDNXBDir); ViewCenter.Instance.GetPanel <Panel_Player_Bottom>(PanelType.Player_BOTTOM).ShowAnim(type); } else if (type != ResultType.糊 && type != ResultType.过) { DataCenter.Instance.gamedata.IsChuPaing = false; } //switch (type) //{ // case ResultType.吃: // break; // case ResultType.碰: // DataCenter.Instance.players[playerId].MJ_IN_List.Remove(DataCenter.Instance.gamedata.CurChuMJ.type); // DataCenter.Instance.players[playerId].MJ_IN_List.Remove(DataCenter.Instance.gamedata.CurChuMJ.type); // break; // case ResultType.杠: // break; // case ResultType.糊: // break; // case ResultType.过: // break; // case ResultType.自摸: // break; // default: // break; //} //ReflushPlayerPanel(playerId); }
public void ReInit() { _playerId = 0; _mjType = MJType.Null; }