public RemoteServer(RemoteComponent objRemoteComponent, RemoteChannel objRemoteChannel) { Status = RemoteServerStatusType.Stopped; RemoteComponent = objRemoteComponent; RemoteChannel = objRemoteChannel; Channel = null; }
protected virtual void Dispose(bool blnDisposing) { if (_blnIsDisposed == false) { if (blnDisposing == true) { } _objRemoteChannel = null; if (_objReferencePointer != null) { RemotingServices.Unmarshal(_objReferencePointer); _objReferencePointer = null; } if (_objRemoteComponent != null) { RemotingServices.Disconnect(_objRemoteComponent); _objRemoteComponent = null; } if (_objChannel != null) { RemoteChannel.UnRegisterChannel(_objChannel); _objChannel = null; } } _blnIsDisposed = true; }
public static RemoteChannel GetNextChannel(RemoteChannel channel) { const int totalChannels = 3; var nextChannel = Mathf.Clamp(((int)channel + 1) % totalChannels, 0, totalChannels - 1); return((RemoteChannel)nextChannel); }
public override void Load(object[] args) { if (client == null) { // Attempt to start AOSClient if not already started if (AOSClient.Instance == null && !AOSClient.Initialize()) { throw new Exception("Failed to initialize AOSClient!"); } // Setup some common shortcuts client = AOSClient.Instance; snapshotComponent = client.GetComponent <SnapshotNetComponent>(); objectComponent = client.GetComponent <ObjectNetComponent>(); netPlayerComponent = client.GetComponent <NetPlayerComponent>(); // Grab the screen channel channel = client.GetChannel(AOSChannelType.Screen); // Make sure to move on the initialization to specific screens. OnClientInitialized(); } base.Load(args); }
public NetPlayerComponent(AOSServer server) : base(server) { netPlayers = new BiDictionary <NetConnection, NetworkPlayer>(); stashedClientInfo = new Dictionary <NetConnection, ClientInfo>(); channel = server.GetChannel(AOSChannelType.NetInterface); snapshotComponent = server.GetComponent <SnapshotNetComponent>(); channel.AddRemoteEvent("Server_ClientInfo", R_ClientInfo); }
public SnapshotSystem(NetMessenger messenger) { idAllocator = new IdAllocatorUInt16(); interfaces = new Dictionary <NetConnection, SnapshotConnectionInterface>(); snapshotsAwaitingDeltaSupport = new HashSet <Snapshot>(); channel = messenger.GetChannel((ushort)AOSChannelType.SnapshotSystem); channel.AddRemoteEvent("AllocateSnapshotId", R_AllocateSnapshotId); DashCMD.SetCVar("log_snapshots", false); }
public static Command_Action MakeChannelGizmo(RemoteChannel desiredChannel, RemoteChannel currentChannel, Action activateCallback) { return(new Command_Action { action = activateCallback, icon = GetUITextureForChannel(desiredChannel), activateSound = Resources.Sound.RemoteUIDialClick, defaultDesc = ChannelDialDesc, defaultLabel = String.Format(ChannelDialLabelBase, GetChannelName(desiredChannel), desiredChannel != currentChannel?"RemoteExplosive_channel_switching".Translate():""), hotKey = Resources.KeyBinging.RemoteExplosivesNextChannel }); }
public NetPlayerComponent(AOSClient client) : base(client) { netPlayers = new Dictionary <ushort, NetworkPlayer>(); channel = client.GetChannel(AOSChannelType.NetInterface); snapshotComponent = client.GetComponent <SnapshotNetComponent>(); channel.AddRemoteEvent("Client_AddNetPlayer", R_AddNetPlayer); channel.AddRemoteEvent("Client_RemoveNetPlayer", R_RemoveNetPlayer); channel.AddRemoteEvent("Client_AddInitialNetPlayers", R_AddInitialNetPlayers); }
public void Start() { if (Channel == null) { Channel = RemoteChannel.RegisterChannel(RemoteChannel); } if (ReferencePointer == null) { ReferencePointer = RemotingServices.Marshal(RemoteComponent, RemoteChannel.ChannelName); } Status = RemoteServerStatusType.Running; }
protected virtual void Dispose(bool blnDisposing) { if (_blnIsDisposed == false) { if (blnDisposing == true) { } _objRemoteChannel = null; _objRemoteChannel = null; } _blnIsDisposed = true; }
public virtual void Load(object[] args) { if (server == null) { // Setup common shortcuts server = AOSServer.Instance; snapshotComponent = server.GetComponent <SnapshotNetComponent>(); objectComponent = server.GetComponent <ObjectNetComponent>(); netPlayerComponent = server.GetComponent <NetPlayerComponent>(); // Grab the channel channel = server.GetChannel(AOSChannelType.Screen); // Pass on the one-time initialization OnServerInitialized(); } OnLoad(args); }
public ServerWorld() { players = new ConcurrentDictionary <NetConnection, ServerMPPlayer>(); physEntities = new Dictionary <ushort, GameObject>(); server = AOSServer.Instance; snapshotComponent = server.GetComponent <SnapshotNetComponent>(); objectComponent = server.GetComponent <ObjectNetComponent>(); channel = server.GetChannel(AOSChannelType.World); channel.AddRemoteEvent("Server_SetBlock", R_SetBlock); channel.AddRemoteEvent("Server_ThrowGrenade", R_ThrowGrenade); channel.AddRemoteEvent("Server_ShootMelon", R_ShootMelon); objectComponent.OnCreatableInstantiated += ObjectComponent_OnCreatableInstantiated; objectComponent.OnCreatableDestroyed += ObjectComponent_OnCreatableDestroyed; snapshotComponent.OnWorldSnapshotOutbound += Server_OnWorldSnapshotOutbound; InitializeCMD(); ConfigSection gameSection = Program.Config.GetSection("Game"); if (gameSection == null) { DashCMD.WriteError("[server.cfg - ServerWorld] Section 'Game' is missing!"); } else { string worldFile = gameSection.GetString("world-file"); if (!string.IsNullOrWhiteSpace(worldFile)) { LoadFromFile(worldFile); } else { DashCMD.WriteError("[server.cfg - ServerWorld] Game.world-file is missing!"); } } }
public MPWorld(MasterRenderer renderer) : base(renderer) { players = new Dictionary <ushort, ClientPlayer>(); physEntities = new Dictionary <ushort, GameObject>(); TimeOfDay = 10; // Grab network components and the world channel client = AOSClient.Instance; snapshotComponent = client.GetComponent <SnapshotNetComponent>(); objectComponent = client.GetComponent <ObjectNetComponent>(); channel = client.GetChannel(AOSChannelType.World); // Add remotes channel.AddRemoteEvent("Client_ThrowGrenade", R_ThrowGrenade); channel.AddRemoteEvent("Client_ShootMelon", R_ShootMelon); channel.AddRemoteEvent("Client_ServerImpact", R_ServerImpact); channel.AddRemoteEvent("Client_RolledBackServerPlayer", R_RolledBackServerPlayer); // Hook into component events objectComponent.OnCreatableInstantiated += ObjectComponent_OnCreatableInstantiated; objectComponent.OnCreatableDestroyed += ObjectComponent_OnCreatableDestroyed; snapshotComponent.OnWorldSnapshotInbound += SnapshotComponent_OnWorldSnapshotInbound; }
public static TRemoteComponent Connect <TRemoteComponent>(RemoteChannel objRemoteChannel) where TRemoteComponent : RemoteComponent { RemoteChannel.RegisterCallBackChannel(objRemoteChannel); return((TRemoteComponent)Activator.GetObject(typeof(TRemoteComponent), objRemoteChannel.Uri)); }
public RemoteClient(RemoteChannel objRemoteChannel) { RemoteChannel = objRemoteChannel; RemoteComponent = null; }
public static void LightArmedExplosivesInRange(IntVec3 center, Map map, float radius, RemoteChannel channel) { var armedExplosives = FindArmedExplosivesInRange(center, map, radius, channel); if (armedExplosives.Count > 0) { // closer ones will go off first armedExplosives = armedExplosives.OrderBy(e => e.Position.DistanceToSquared(center)).ToList(); for (int i = 0; i < armedExplosives.Count; i++) { var explosive = armedExplosives[i]; HugsLibController.Instance.CallbackScheduler.ScheduleCallback(explosive.LightFuse, TicksBetweenTriggers * i); } } else { Messages.Message("Detonator_notargets".Translate(), MessageSound.Standard); } }
public static string GetCurrentChannelInspectString(RemoteChannel currentChannnel) { return(String.Format(CurrenthannelLabelBase, GetChannelName(currentChannnel))); }
public static string GetChannelName(RemoteChannel channel) { return(("RemoteExplosive_channel" + ((int)channel)).Translate()); }
public static List <Building_RemoteExplosive> FindArmedExplosivesInRange(IntVec3 center, Map map, float radius, RemoteChannel channel) { var results = new List <Building_RemoteExplosive>(); var sample = map.listerBuildings.AllBuildingsColonistOfClass <Building_RemoteExplosive>(); foreach (var explosive in sample) { if (explosive.IsArmed && explosive.CurrentChannel == channel && !explosive.FuseLit && TileIsInRange(explosive.Position, center, radius)) { results.Add(explosive); } } return(results); }
private static Texture2D GetUITextureForChannel(RemoteChannel channel) { return(UITex_Channels[(int)channel]); }