public void OnStartHitting() { if (OpType == OpType.Pass) { // 此轮跳过,延迟1秒到下一位 CmdResponse.RandomOperation(null, OpType); // todo: 延迟 NextPlayer(); return; } // 检查是否有选定的颜色,如果已经没有相应的颜色,则再次随机 if (OpType != OpType.Both && !HexManager.HasColor(OpType)) { // 重新随机 return; } GameStep = GameStep.Hitting; foreach (Player p in m_players.Values) { CmdResponse.StartHitting(p, OpType); } }
public void OnGameOver() { GameStep = GameStep.GameOver; foreach (Player p in m_players.Values) { CmdResponse.EndGame(p); } }
public void ToGame() { CurPlayer = 1; GameStep = GameStep.SelectingMain; foreach (Player p in m_players.Values) { CmdResponse.StartGame(p); } }
public void OnPlayerLogin(Player player) { foreach (Player p in m_players.Values) { if (p == player) { continue; } CmdResponse.LoginResponse(player, Owner.GUID, new List <Player>(m_players.Values), GameConf); } }
public void SetMain(int x, int y) { m_mainHex = HexManager.GetHexagon(x, y) as GameHexagon; m_mainHex.IsMain = true; GameStep = GameStep.Start; // 开始随机 // GameStep = GameStep.RandomOperation; foreach (Player p in m_players.Values) { CmdResponse.MainHex(p, x, y); } }
private void NextPlayer(bool isGood = false) { ++CurPlayer; if (CurPlayer > GameConf.MemCount) { CurPlayer = 1; } foreach (Player p in m_players.Values) { CmdResponse.CurrentPlayer(p, 0); CmdResponse.SetScore(p, 1, 0); } string goodOrNot = isGood ? "GOOD!!!\n" : ""; }
public void EndHammer() { if (m_curTargetHex == null) { return; } float strength = 0;// UIManager.GetUIByType<UIGame>().StopSliderMoving() * c_strenghtSensitivity; //if (m_curTargetHex == GetHittingHex()) { //if(strength > 0.95f) //{ // GameView.ShowTips("GOOD !!!"); //} // 锤子 CmdResponse.HammerKnock(null, strength); } //else //{ // m_curTargetHex = null; // m_singleTargetHex = null; //} // 重置力度 // 下一轮 m_curTargetHex.OnHit(strength); HexManager.UpdateAllBalance(); // 如果是强制砸落,则必须当前块掉落再进行下一轮 if (!(m_curTargetHex.IsActive() && GameConf.ForceKill)) { // if (GameStep != GameStep.GameOver) { GameStep = GameStep.RandomOperation; CmdResponse.CurrentPlayer(null, 0); } m_singleTargetHex = null; } m_curTargetHex = null; }
private static bool CheckColor(GameHexagon hex, OpType op) { if (op == OpType.Pass) { return(false); } else if (op == OpType.Both) { return(true); } else { if (hex.OpType != op) { CmdResponse.Alert(null, string.Format("<color=yellow>必须砸{0}颜色块!</color>", UIConstants.s_ops[op])); } return(hex.OpType == op); } }
public void StartHammer(int x, int y) { if (m_curTargetHex != null) { return; } GameHexagon theHex = HexManager.GetHexagon(x, y) as GameHexagon; // 在强制模式下,必须砸同一个格子 if (GameConf.ForceKill && m_singleTargetHex != null && m_singleTargetHex != theHex) { CmdResponse.Alert(CurrentPlayer, "必须砸同一个格子!"); return; } if (theHex != null && theHex != m_mainHex && CheckColor(theHex, OpType)) { m_curTargetHex = theHex; m_singleTargetHex = theHex; // 重置力度 } }