Ejemplo n.º 1
0
            public bool SendRuleMessage()
            {
                MahjongServer host = __instance == null ? null : __instance.host as MahjongServer;

                if (host == null)
                {
                    return(false);
                }

                Node node;

                if (!host.GetNode(__instance.node.index, out node) || node.connectionId < 0)
                {
                    return(false);
                }

                ReadOnlyCollection <Mahjong.RuleNode> ruleNodes = Start();

                if (ruleNodes == null || ruleNodes.Count < 1)
                {
                    return(false);
                }

                host.SendRuleMessage(node.connectionId, ruleNodes);

                return(true);
            }
Ejemplo n.º 2
0
            private void __Reset()
            {
                if (__instance == null)
                {
                    return;
                }

                if (__tileCodes != null)
                {
                    MahjongServer host = __instance.host as MahjongServer;
                    if (host != null)
                    {
                        Node node;
                        if (host.GetNode(__instance.node.index, out node) && node.connectionId >= 0)
                        {
                            host.SendTileCodeMessage(node.connectionId, (byte)__tileCodes.Length, __tileCodes);
                        }
                    }
                }
            }
Ejemplo n.º 3
0
            public new void Reset()
            {
                __isShow = false;

                if (__room != null)
                {
                    if (__room.__mahjong != null)
                    {
                        __instance.type = (short)((this.index + 4 - __room.__mahjong.dealerIndex) & 3);
                    }

                    if (__room.isRunning)
                    {
                        MahjongServer host = __instance == null ? null : __instance.host as MahjongServer;
                        if (host != null)
                        {
                            Node node;
                            if (host.GetNode(__instance.node.index, out node) && node.connectionId >= 0)
                            {
                                host.SendShuffleMessage(node.connectionId, (byte)__room.point0, (byte)__room.point1, (byte)__room.point2, (byte)__room.point3, (byte)__room.tileCount);
                            }
                        }
                    }
                }

                int count = (int)Mahjong.TileType.Unknown, step = (256 - count) / count;

                if (__tileCodes == null)
                {
                    __tileCodes = new byte[count];
                }

                int index = 0;

                for (int i = 0; i < count; ++i)
                {
                    __tileCodes[i] = (byte)UnityEngine.Random.Range(index, index += step);
                }

                __Reset();
            }
Ejemplo n.º 4
0
            public bool SendReadyHand()
            {
                MahjongServer host = __instance == null ? null : __instance.host as MahjongServer;

                if (host == null)
                {
                    return(false);
                }

                Node node;

                if (!host.GetNode(__instance.node.index, out node) || node.connectionId < 0)
                {
                    return(false);
                }

                if (__readyHandleIndices == null)
                {
                    __readyHandleIndices = new List <byte>();
                }
                else
                {
                    __readyHandleIndices.Clear();
                }

                IEnumerator <int> checker = GetChecker(null);

                while (checker.MoveNext())
                {
                    __readyHandleIndices.Add((byte)checker.Current);
                }

                if (__readyHandleIndices.Count < 1)
                {
                    return(false);
                }

                host.SendReadyHandMessage(node.connectionId, __readyHandleIndices.AsReadOnly());

                return(true);
            }