Exemple #1
0
        public override void Initialize(NetworkObject obj)
        {
            // We have already initialized this object
            if (networkObject != null && networkObject.AttachedBehavior != null)
            {
                return;
            }

            networkObject = (ChatManagerNetworkObject)obj;
            networkObject.AttachedBehavior = this;

            base.SetupHelperRpcs(networkObject);
            networkObject.RegisterRpc("SendMessage", SendMessage, typeof(string), typeof(string));
            networkObject.RegistrationComplete();

            MainThreadManager.Run(NetworkStart);

            networkObject.onDestroy += DestroyGameObject;

            if (!obj.IsOwner)
            {
                if (!skipAttachIds.ContainsKey(obj.NetworkId))
                {
                    ProcessOthers(gameObject.transform, obj.NetworkId + 1);
                }
                else
                {
                    skipAttachIds.Remove(obj.NetworkId);
                }
            }
        }
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case GameLogicNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GameLogicNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case PlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerNetworkObject(networker, id, frame);
                    break;

                case GameBallNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GameBallNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
Exemple #3
0
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (NetworkManager.Instance.IsMaster)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case GameModeNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GameModeNetworkObject(networker, id, frame);
                    break;

                case PlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    ///obj = new PlayerNetworkObject(networker, id, frame);
                    obj = new PlayerNetworkObject();
                    PlayerNetworkObject playerObj = (PlayerNetworkObject)obj;
                    playerObj.SetupUID((int)id, true);
                    break;

                case WeaponPickupNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new WeaponPickupNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
Exemple #4
0
        public void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;
                }

                if (callback != null)
                {
                    callback(obj);
                }
            });

            if (!availableCallback && callback != null)
            {
                callback(obj);
            }
        }
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case DefenderManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new DefenderManagerNetworkObject(networker, id, frame);
                    break;

                case DefenderNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new DefenderNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case LeftGoalHandNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new LeftGoalHandNetworkObject(networker, id, frame);
                    break;

                case MoveBallNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new MoveBallNetworkObject(networker, id, frame);
                    break;

                case MoveGoalNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new MoveGoalNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case rightGoalHandNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new rightGoalHandNetworkObject(networker, id, frame);
                    break;

                case ShootBalloonNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ShootBalloonNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;

                case ShooterPlayerMovementNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ShooterPlayerMovementNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
        public override void Initialize(NetworkObject obj)
        {
            // We have already initialized this object
            if (networkObject != null && networkObject.AttachedBehavior != null)
            {
                return;
            }

            networkObject = (ChatManagerNetworkObject)obj;
            networkObject.AttachedBehavior = this;

            base.SetupHelperRpcs(networkObject);
            networkObject.RegisterRpc("SendMessage", SendMessage, typeof(string), typeof(string), typeof(string), typeof(string));
            networkObject.RegisterRpc("RestartTranscript", RestartTranscript);
            networkObject.RegisterRpc("ChangeActionPosition", ChangeActionPosition, typeof(string), typeof(string));

            networkObject.onDestroy += DestroyGameObject;

            if (!obj.IsOwner)
            {
                if (!skipAttachIds.ContainsKey(obj.NetworkId))
                {
                    uint newId = obj.NetworkId + 1;
                    ProcessOthers(gameObject.transform, ref newId);
                }
                else
                {
                    skipAttachIds.Remove(obj.NetworkId);
                }
            }

            if (obj.Metadata != null)
            {
                byte transformFlags = obj.Metadata[0];

                if (transformFlags != 0)
                {
                    BMSByte metadataTransform = new BMSByte();
                    metadataTransform.Clone(obj.Metadata);
                    metadataTransform.MoveStartIndex(1);

                    if ((transformFlags & 0x01) != 0 && (transformFlags & 0x02) != 0)
                    {
                        MainThreadManager.Run(() =>
                        {
                            transform.position = ObjectMapper.Instance.Map <Vector3>(metadataTransform);
                            transform.rotation = ObjectMapper.Instance.Map <Quaternion>(metadataTransform);
                        });
                    }
                    else if ((transformFlags & 0x01) != 0)
                    {
                        MainThreadManager.Run(() => { transform.position = ObjectMapper.Instance.Map <Vector3>(metadataTransform); });
                    }
                    else if ((transformFlags & 0x02) != 0)
                    {
                        MainThreadManager.Run(() => { transform.rotation = ObjectMapper.Instance.Map <Quaternion>(metadataTransform); });
                    }
                }
            }

            MainThreadManager.Run(() =>
            {
                NetworkStart();
                networkObject.Networker.FlushCreateActions(networkObject);
            });
        }
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case GameFactionsNetworkControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GameFactionsNetworkControllerNetworkObject(networker, id, frame);
                    break;

                case GameUINetworkEntityNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GameUINetworkEntityNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case PlayerAvatorControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerAvatorControllerNetworkObject(networker, id, frame);
                    break;

                case PlayerDestinationControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerDestinationControllerNetworkObject(networker, id, frame);
                    break;

                case PlayerEntityModelNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerEntityModelNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;

                case TowerCaptureNetworkControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TowerCaptureNetworkControllerNetworkObject(networker, id, frame);
                    break;

                case TowerEntityControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TowerEntityControllerNetworkObject(networker, id, frame);
                    break;

                case TowerUIEntityNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TowerUIEntityNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
Exemple #8
0
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case AetherNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new AetherNetworkObject(networker, id, frame);
                    break;

                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case DamageNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new DamageNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case LobbyPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new LobbyPlayerNetworkObject(networker, id, frame);
                    break;

                case LobbySystemNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new LobbySystemNetworkObject(networker, id, frame);
                    break;

                case MonsterAttackNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new MonsterAttackNetworkObject(networker, id, frame);
                    break;

                case MonsterObjectNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new MonsterObjectNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case PlayerNetworkManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerNetworkManagerNetworkObject(networker, id, frame);
                    break;

                case PlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerNetworkObject(networker, id, frame);
                    break;

                case SkillsNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new SkillsNetworkObject(networker, id, frame);
                    break;

                case SwordSlashNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new SwordSlashNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;

                case TowerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TowerNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case BillboardNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new BillboardNetworkObject(networker, id, frame);
                    break;

                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CodeNamesGameStateNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CodeNamesGameStateNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case ForgePlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ForgePlayerNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case NodeServiceNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NodeServiceNetworkObject(networker, id, frame);
                    break;

                case RandomMovingNPCNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new RandomMovingNPCNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;

                case TokenPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TokenPlayerNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
Exemple #10
0
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case DroneNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new DroneNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case GunnerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GunnerNetworkObject(networker, id, frame);
                    break;

                case MothershipNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new MothershipNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case NetworkFlowNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkFlowNetworkObject(networker, id, frame);
                    break;

                case PilotNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PilotNetworkObject(networker, id, frame);
                    break;

                case Player1PositionNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new Player1PositionNetworkObject(networker, id, frame);
                    break;

                case SeekerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new SeekerNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
Exemple #11
0
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case AnimTestObjNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new AnimTestObjNetworkObject(networker, id, frame);
                    break;

                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case FlameAttacckNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new FlameAttacckNetworkObject(networker, id, frame);
                    break;

                case GameModeNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GameModeNetworkObject(networker, id, frame);
                    break;

                case PlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;

                case ThrowObjNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ThrowObjNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case BarrierBlockNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new BarrierBlockNetworkObject(networker, id, frame);
                    break;

                case BattleNetworkNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new BattleNetworkNetworkObject(networker, id, frame);
                    break;

                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case HomeBaseNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new HomeBaseNetworkObject(networker, id, frame);
                    break;

                case LobbyDotsNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new LobbyDotsNetworkObject(networker, id, frame);
                    break;

                case LobbyPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new LobbyPlayerNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case PlayerControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerControllerNetworkObject(networker, id, frame);
                    break;

                case PlayerDrawNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerDrawNetworkObject(networker, id, frame);
                    break;

                case PlayerStatsNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new PlayerStatsNetworkObject(networker, id, frame);
                    break;

                case ProjectileNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ProjectileNetworkObject(networker, id, frame);
                    break;

                case ServerInfoNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ServerInfoNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;

                case TimerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TimerNetworkObject(networker, id, frame);
                    break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }
Exemple #13
0
        public override void NetworkCreateObject(NetWorker networker, int identity, uint id, FrameStream frame, Action <NetworkObject> callback)
        {
            if (networker.IsServer)
            {
                if (frame.Sender != null && frame.Sender != networker.Me)
                {
                    if (!ValidateCreateRequest(networker, identity, id, frame))
                    {
                        return;
                    }
                }
            }

            bool          availableCallback = false;
            NetworkObject obj = null;

            MainThreadManager.Run(() =>
            {
                switch (identity)
                {
                case ChatManagerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ChatManagerNetworkObject(networker, id, frame);
                    break;

                case CubeForgeGameNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new CubeForgeGameNetworkObject(networker, id, frame);
                    break;

                case ExampleProximityPlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ExampleProximityPlayerNetworkObject(networker, id, frame);
                    break;

                case GuyNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new GuyNetworkObject(networker, id, frame);
                    break;

                case MovePlayerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new MovePlayerNetworkObject(networker, id, frame);
                    break;

                case NetworkCameraNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new NetworkCameraNetworkObject(networker, id, frame);
                    break;

                case ObjectNetworkStatusNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ObjectNetworkStatusNetworkObject(networker, id, frame);
                    break;

                case ObjectsControllerNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new ObjectsControllerNetworkObject(networker, id, frame);
                    break;

                case TestNetworkObject.IDENTITY:
                    availableCallback = true;
                    obj = new TestNetworkObject(networker, id, frame);
                    break;
                    // case PlayerSpawnNetworkObject.IDENTITY:
                    //   availableCallback = true;
                    //   obj = new PlayerSpawnNetworkObject(networker, id, frame);
                    //   break;
                }

                if (!availableCallback)
                {
                    base.NetworkCreateObject(networker, identity, id, frame, callback);
                }
                else if (callback != null)
                {
                    callback(obj);
                }
            });
        }