public override GameState GetMessage(MjsonMessageAll msgobj) { if (msgobj.IsNONE()) { getMsgList.Add(msgobj); if ((getMsgList.Count == Constants.PLAYER_NUM)) { if (serverController.CanEndGame()) { serverController.SendEndgame(); return(new EndState(this)); } else { serverController.StartKyoku(); return(new AfterStartKyokuState(this)); } } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return(this); }
public override GameState GetMessage(MjsonMessageAll msgobj) { if ((msgobj.IsDAHAI()) || (msgobj.IsNONE())) { getMsgList.Add(msgobj); if (getMsgList.Count(e => e.IsDAHAI()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var dahaiObj = getMsgList.First(e => e.IsDAHAI()); serverController.Dahai(dahaiObj.actor, dahaiObj.pai, dahaiObj.tsumogiri); getMsgList.Dispose(); return(new AfterReachDahaiState(this)); } if ((getMsgList.Count == Constants.PLAYER_NUM)) { serverController.SendErrorToRoomMember(msgobj); } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return(this); }
public override GameState GetMessage(MjsonMessageAll msgobj) { if (msgobj.IsNONE()) { getMsgList.Add(msgobj); if (getMsgList.Count < Constants.PLAYER_NUM) { return(this); } //受け継いだメッセージ内に4人共アクションがない場合 if (prevMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM) { //終局判定 if (serverController.CanFinishKyoku()) { serverController.Ryukyoku(); getMsgList.Dispose(); return(new AfterRyukyokuState(this)); } else { //ツモ状態へ移行 serverController.Tsumo(); return(new AfterTsumoState(this)); } } //hora else if (prevMsgList.Count(e => e.IsDAIMINKAN()) == 1) { var daiminkanObj = prevMsgList.First(e => e.IsDAIMINKAN()); serverController.Daiminkan(daiminkanObj.actor, daiminkanObj.target, daiminkanObj.pai, daiminkanObj.consumed); prevMsgList.Dispose(); return(new AfterKanState(this)); } else if (prevMsgList.Count(e => e.IsPON()) == 1) { var ponObj = prevMsgList.First(e => e.IsPON()); serverController.Pon(ponObj.actor, ponObj.target, ponObj.pai, ponObj.consumed); prevMsgList.Dispose(); return(new AfterTsumoState(this)); } else if (prevMsgList.Count(e => e.IsCHI()) == 1) { var chiObj = prevMsgList.First(e => e.IsCHI()); serverController.Chi(chiObj.actor, chiObj.target, chiObj.pai, chiObj.consumed); prevMsgList.Dispose(); return(new AfterTsumoState(this)); } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return(this); }
public override GameState GetMessage(MjsonMessageAll msgobj) { if (msgobj.IsNONE()) { getMsgList.Add(msgobj); if ((getMsgList.Count == Constants.PLAYER_NUM)) { serverController.Rinshan(); getMsgList.Dispose(); return(new AfterTsumoState(this)); } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return(this); }
public override GameState GetMessage(MjsonMessageAll msgobj) { if ((msgobj.IsDAHAI()) || (msgobj.IsREACH()) || (msgobj.IsANKAN()) || (msgobj.IsKAKAN()) || (msgobj.IsHORA()) || (msgobj.IsNONE())) { getMsgList.Add(msgobj); if (getMsgList.Count == Constants.PLAYER_NUM) { // if (getMsgList.Count(e => e.IsHORA()) >= 1) { var horaObj = GetNearestHoraPlayerMsg(getMsgList); serverController.Hora(horaObj.actor, horaObj.target, horaObj.pai); getMsgList.Dispose(); return(new AfterHoraState(this)); } //RinshanFlggOff //serverController.ResetRinshanFlag(); //serverController.ResetIppatsuFlag(); if (getMsgList.Count(e => e.IsDAHAI()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var dahaiObj = getMsgList.Where(e => e.IsDAHAI()) .First(); serverController.Dahai(dahaiObj.actor, dahaiObj.pai, dahaiObj.tsumogiri); getMsgList.Dispose(); return(new AfterDahaiState(this)); } else if (getMsgList.Count(e => e.IsREACH()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var reachObj = getMsgList.First(e => e.IsREACH()); serverController.Reach(reachObj.actor); getMsgList.Dispose(); return(new AfterReachState(this)); } else if (getMsgList.Count(e => e.IsANKAN()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var kanObj = getMsgList.First(e => e.IsREACH()); serverController.Ankan(kanObj.actor, kanObj.target, kanObj.pai, kanObj.consumed); getMsgList.Dispose(); return(new AfterKanState(this)); } } } else { //error handling serverController.SendErrorToRoomMember(msgobj); } return(this); }
public override GameState GetMessage(MjsonMessageAll msgobj) { if (msgobj.IsNONE()) { getMsgList.Add(msgobj); if ((getMsgList.Count == Constants.PLAYER_NUM)) { if (serverController.CanEndGame()) { serverController.SendEndgame(); return new EndState(this); } else { serverController.StartKyoku(); return new AfterStartKyokuState(this); } } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return this; }
public override GameState GetMessage(MjsonMessageAll msgobj) { if (msgobj.IsNONE()) { getMsgList.Add(msgobj); if(getMsgList.Count < Constants.PLAYER_NUM) { return this; } //受け継いだメッセージ内に4人共アクションがない場合 if (prevMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM) { //終局判定 if (serverController.CanFinishKyoku()) { serverController.Ryukyoku(); getMsgList.Dispose(); return new AfterRyukyokuState(this); } else { //ツモ状態へ移行 serverController.Tsumo(); return new AfterTsumoState(this); } } //hora else if (prevMsgList.Count(e => e.IsDAIMINKAN()) == 1) { var daiminkanObj = prevMsgList.First(e => e.IsDAIMINKAN()); serverController.Daiminkan(daiminkanObj.actor, daiminkanObj.target, daiminkanObj.pai, daiminkanObj.consumed); prevMsgList.Dispose(); return new AfterKanState(this); } else if (prevMsgList.Count(e => e.IsPON()) == 1) { var ponObj = prevMsgList.First(e => e.IsPON()); serverController.Pon(ponObj.actor, ponObj.target, ponObj.pai, ponObj.consumed); prevMsgList.Dispose(); return new AfterTsumoState(this); } else if (prevMsgList.Count(e => e.IsCHI()) == 1) { var chiObj = prevMsgList.First(e => e.IsCHI()); serverController.Chi(chiObj.actor, chiObj.target, chiObj.pai, chiObj.consumed); prevMsgList.Dispose(); return new AfterTsumoState(this); } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return this; }
public override GameState GetMessage(MjsonMessageAll msgobj) { if ((msgobj.IsDAHAI()) || (msgobj.IsNONE())) { getMsgList.Add(msgobj); if (getMsgList.Count(e => e.IsDAHAI()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var dahaiObj = getMsgList.First(e => e.IsDAHAI()); serverController.Dahai(dahaiObj.actor, dahaiObj.pai, dahaiObj.tsumogiri); getMsgList.Dispose(); return new AfterReachDahaiState(this); } if ((getMsgList.Count == Constants.PLAYER_NUM)) { serverController.SendErrorToRoomMember(msgobj); } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return this; }
public override GameState GetMessage(MjsonMessageAll msgobj) { if (msgobj.IsNONE()) { getMsgList.Add(msgobj); if ((getMsgList.Count == Constants.PLAYER_NUM)) { serverController.Rinshan(); getMsgList.Dispose(); return new AfterTsumoState(this); } } else { //errorhandling serverController.SendErrorToRoomMember(msgobj); } return this; }
public override GameState GetMessage(MjsonMessageAll msgobj) { if ((msgobj.IsDAHAI()) || (msgobj.IsREACH()) || (msgobj.IsANKAN()) || (msgobj.IsKAKAN()) || (msgobj.IsHORA()) || (msgobj.IsNONE())) { getMsgList.Add(msgobj); if (getMsgList.Count == Constants.PLAYER_NUM) { // if (getMsgList.Count(e => e.IsHORA()) >= 1 ) { var horaObj = GetNearestHoraPlayerMsg(getMsgList); serverController.Hora(horaObj.actor, horaObj.target, horaObj.pai); getMsgList.Dispose(); return new AfterHoraState(this); } //RinshanFlggOff //serverController.ResetRinshanFlag(); //serverController.ResetIppatsuFlag(); if (getMsgList.Count(e => e.IsDAHAI()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var dahaiObj = getMsgList.Where(e => e.IsDAHAI()) .First(); serverController.Dahai(dahaiObj.actor, dahaiObj.pai, dahaiObj.tsumogiri); getMsgList.Dispose(); return new AfterDahaiState(this); } else if (getMsgList.Count(e => e.IsREACH()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var reachObj = getMsgList.First(e => e.IsREACH()); serverController.Reach(reachObj.actor); getMsgList.Dispose(); return new AfterReachState(this); } else if (getMsgList.Count(e => e.IsANKAN()) == 1 && getMsgList.Count(e => e.IsNONE()) == Constants.PLAYER_NUM - 1) { var kanObj = getMsgList.First(e => e.IsREACH()); serverController.Ankan(kanObj.actor, kanObj.target, kanObj.pai, kanObj.consumed); getMsgList.Dispose(); return new AfterKanState(this); } } } else { //error handling serverController.SendErrorToRoomMember(msgobj); } return this; }