public void AddCpgData(CpgData data) { if (data == null) { return; } CpgDatas.Add(data); }
protected virtual void AddCpg(CpgData data, int index = MiscUtility.DefInt) { if (null == data) { return; } var fromInt = data.GetFromChair(); index = fromInt == -1 ? index : fromInt; MahjongCpg cpg = MahjongUtility.CreateCpg(data, index); CpgList.Add(cpg); cpg.transform.ExSetParent(transform); }
private void RecordMahjong(CpgData cpgData) { if (cpgData.Type == EnGroupType.AnGang && (cpgData.Seat != DataCenter.OneselfData.Seat)) { //其他玩家暗杠不进行统计 if (!DataCenter.Config.ShowAnGang) { return; } } if (DataCenter.CurrOpChair != 0 && null != cpgData) { GameCenter.Shortcuts.MahjongQuery.Do(p => p.AddRecordMahjongs(cpgData.GetCardDatas)); } }
public void SetCpg(CpgData data) { if (null == data) { return; } data.Chair = Chair; if (data.Type == EnGroupType.ZhuaGang) { SetZhuaGang(data); } else { AddCpg(data); SortGpg(); } }
public static MahjongCpg CreateCpg(CpgData data, int index = MiscUtility.DefInt) { GameObject cpg = new GameObject(); MahjongCpg ret = null; switch (data.Type) { case EnGroupType.Chi: ret = cpg.AddComponent <MahjongCpgChi>(); break; case EnGroupType.JueGang: case EnGroupType.Peng: case EnGroupType.PengGang: ret = cpg.AddComponent <MahjongCpg>(); break; case EnGroupType.ZhuaGang: ret = cpg.AddComponent <MahjongCpgZhuaGang>(); break; case EnGroupType.MingGang: case EnGroupType.AnGang: ret = cpg.AddComponent <MahjongCpgAngang>(); break; case EnGroupType.XFGang: ret = cpg.AddComponent <MahjongCpgXFGang>(); break; case EnGroupType.YaoDan: case EnGroupType.JiuDan: case EnGroupType.ZFBDan: case EnGroupType.XFDan: ret = cpg.AddComponent <MahjongCpgXjfdGang>(); break; case EnGroupType.AnJueGang: ret = cpg.AddComponent <MahjongCpgAnJuegang>(); break; } ret.Init(data, index); return(ret); }
public void SetData(ISFSObject data) { var db = GameCenter.DataCenter; db.CurrOpSeat = data.TryGetInt(RequestKey.KeySeat); GangBao = data.ContainsKey("bao"); CurrOpChair = db.CurrOpChair; OldOpChair = db.OldOpChair; CpgData = MahjongUtility.CreateCpg(data); CpgData.Laizi = db.Game.LaiziCard; //cpg中有赖子牌,标记Icon CpgType = CpgData.Type; db.Players[db.CurrOpChair].IsTuiDan = data.ContainsKey("tuidan"); if (CpgType != EnGroupType.ZhuaGang && IsNotXjfdType(CpgType)) { //将cpg信息添加到玩家数据中 GameCenter.DataCenter.Players[CurrOpChair].CpgDatas.Add(CpgData); } CpgModel = new CpgModel(data); }
protected virtual void SetZhuaGang(CpgData data) { if (null == data) { return; } for (int i = 0; i < CpgList.Count; i++) { MahjongCpg cpgPeng = CpgList[i]; if (cpgPeng.Data.Type == EnGroupType.Peng && cpgPeng.Data.Card == data.Card) { //保存碰的位子 Vector3 pengPos = cpgPeng.transform.localPosition; cpgPeng.OnReset(); MahjongCpg cpgZhuaGang = MahjongUtility.CreateCpg(data, cpgPeng.AcrossIndex); cpgZhuaGang.transform.SetParent(transform); cpgZhuaGang.transform.localScale = Vector3.one; cpgZhuaGang.transform.localPosition = pengPos; cpgZhuaGang.transform.localRotation = Quaternion.Euler(Vector3.zero); CpgList[i] = cpgZhuaGang; break; } } }
public static CpgData CreateCpg(ISFSObject data) { CpgData ret = null; EnGroupType type = EnGroupType.None; if (data.ContainsKey(ProtocolKey.KeyTType)) { type = (EnGroupType)(data.GetInt(ProtocolKey.KeyTType)); } else if (data.ContainsKey(RequestKey.KeyType)) { type = (EnGroupType)(data.GetInt(RequestKey.KeyType)); } switch (type) { case EnGroupType.Chi: ret = new CpgChi(); break; case EnGroupType.JueGang: case EnGroupType.Peng: ret = new CpgPeng(); break; case EnGroupType.ZhuaGang: ret = new CpgZhuaGang(); break; case EnGroupType.MingGang: case EnGroupType.AnGang: { if (data.ContainsKey("bao")) { ret = new CpgSelfGangBao(); } else { ret = new CpgSelfGang(); } } break; case EnGroupType.PengGang: ret = new CpgOtherGang(); break; case EnGroupType.XFGang: case (EnGroupType)NetworkProtocol.MJRequestTypeXFG: ret = new CpgXFGang(); break; case EnGroupType.XFDan: case EnGroupType.ZFBDan: case EnGroupType.YaoDan: case EnGroupType.JiuDan: ret = new CpgXfdGang(); break; case EnGroupType.AnJueGang: ret = new CpgAnJueGang(); break; } ret.ParseData(data); return(ret); }