private bool __SetEvent(ReadOnlyCollection <Mahjong.RuleNode> ruleNodes, ReadOnlyCollection <int> ruleIndices, Button button) { if (button == null) { return(false); } int numRules = ruleIndices == null ? 0 : ruleIndices.Count; if (numRules < 1) { return(false); } GameObject gameObject = button.gameObject; if (gameObject != null) { gameObject.SetActive(true); } Button.ButtonClickedEvent buttonClickedEvent = new Button.ButtonClickedEvent(); button.onClick = buttonClickedEvent; UnityAction listener = null; listener = delegate() { MahjongClientPlayer player = localPlayer as MahjongClientPlayer; if (player == null) { return; } if (numRules < 2) { player.Try((byte)ruleIndices[0]); __ClearTry(); } else { foreach (int ruleIndex in ruleIndices) { int temp = ruleIndex; player.Select(ruleNodes[temp].index, delegate() { player.Try((byte)temp); __ClearTry(); }); } } }; buttonClickedEvent.AddListener(listener); return(true); }
private void __PassTry() { MahjongClientPlayer player = localPlayer as MahjongClientPlayer; if (player != null) { player.Try(255); } __ClearTry(); }