//------------------------------ //向房主请求pick一张牌.. 如果同意才pick那张牌 //----------------------------- public void RequestInitialPick(Transform brick) { print("RequestInitialPick masterID is " + _client.CurrentRoom.MasterClientId); print("And my ID is " + _myID); //如果我不是房主 向房主请求 if (_client.CurrentRoom.MasterClientId != _myID) { int[] msg = { _myID, AllBricks.IndexOf(brick) }; _client.OpRaiseEvent(MyEventCode.RequestInitialPick, msg , true, RaiseEventOptions.Default); } //如果我是房主..就自己做判断,然后将结果Confirm给其他玩家 else { //该棋子unOccupied confirm 给所有其他玩家 if (UnOccupiedBricks.Contains(brick)) { //可以移动这张牌 于是移动之 AUserPickABrick(_myID, brick); //通知其他玩家 int[] msg = { _myID, AllBricks.IndexOf(brick) }; _client.OpRaiseEvent(MyEventCode.ConfirmInitialPick, msg , true, RaiseEventOptions.Default); //拿齐了四个 if (Decks[_myDeckIndex].Count >= 4) { //状态进入整理自己的牌 GameState.Instance.CurrentState = GameState.State.Adjust; PostInitialPick(); } } } }
//---------------------------------------- //房主处理别人的InitialPickRequest/ //----------------------------------------- void HandleInitialPickRequest(int id, int index) { //该棋子unOccupied 同意pick if (UnOccupiedBricks.Contains(AllBricks[index])) { //可以pick这张牌 pick之 OnInitialPickConfirmation(id, index); //通知其他玩家 int[] msg = { id, index }; _client.OpRaiseEvent(MyEventCode.ConfirmInitialPick, msg, true, RaiseEventOptions.Default); } //该棋子已经occupied 不回复 }