/// <summary> /// Initializes a new instance of the <see cref="SurvivalKit.Events.Network.ReadPacketFromBufEvent"/> class. /// </summary> /// <param name="args"> /// An object array of data to pass to the event. /// args[0] (bool) indicates whether the event is cancelled /// args[1] (string) the name of the fired RPC. /// args[2] (object) the first argument of the fired RPC. (following args contain following RPC arguments) /// </param> public RPCEvent(Object[] args) { if (args == null || args.Length < 3) { throw new ArgumentNullException(); } this.cancelled = (bool)args[0]; this.name = (string)args[1]; this.args = new object[args.Length - 2]; for (int i = 2; i < args.Length; i++) { this.args[i - 2] = args[i]; } if (this.name.Equals("RPC_ChatMessage") && this.args[0] != null) //string _msg, int _teamNo, string _playerName, bool _bOpenWdw { string message = (string)this.args[0]; if (message.Length <= 0) { this.cancelled = true; } else if (message.Length > 1 && message[0] == '/') { string[] splitCmd = message.Split(new char[] { ' ' }); string[] cmdArgs = new string[splitCmd.Length - 1]; for (int i = 1; i < splitCmd.Length; i++) { cmdArgs[i - 1] = splitCmd[i]; } splitCmd[0] = splitCmd[0].Substring(1); UnityEngine.NetworkPlayer networkPlayer = ((UnityEngine.NetworkMessageInfo) this.args[this.args.Length - 1]).sender; foreach (GameManager curGmgr in SKMain.SkMain.activeGameManagers()) { EntityPlayer playerEntity = SKMain.getPlayerEntity(networkPlayer, curGmgr); if (playerEntity == null) { continue; } string alias = splitCmd[0], command = splitCmd[0]; var commandSender = new SurvivalKit.Permissions.PlayerCommandSender(playerEntity, networkPlayer); var isCancelled = EventAggregator.GetInstance().DispatchCommand(command, commandSender, alias, cmdArgs); if (isCancelled) { cancelled = true; // Why do we set these arguments to null? Shouldn't we set the properties 'name' and 'rpcclass' to null? this.args[0] = null; this.args[1] = null; break; } } } } }
static void Main() { AppContextManager context = new AppContextManager(); SKMain.Main_WinTrayApp(context.AppContext, FlickrSyncMonitorForm.APP_NAME, true); //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { ManagerClass obj = new ManagerClass(); SKMain.Main_WinTrayApp(obj.AppContext, "asdasdad", true); } catch (Exception exp) { Logger.DisplayError(exp.Message); } }
/// <summary> /// Makes a DefiniteName of a name of an unknown type (either definite name, player name or steamid). /// </summary> /// <returns>The definite name. Note that if a steamid is given and another player is named by that id, the wrong name may get returned.</returns> /// <param name="name">The name that may be a definite name, a player name or a steamid.</param> public static string MakeDefiniteName(string name) { if (name.StartsWith("player;steam=") && name.EndsWith(";")) { return(name); } foreach (EntityPlayer curPlayer in SKMain.SkMain.currentGameManager().World.playerEntities.list) { string curSteamId = SKMain.getClientInfo(curPlayer.EntityName).playerId; if (curSteamId == null || curSteamId.Length == 0) { continue; } if (curPlayer.EntityName.ToLower().Equals(name.ToLower()) || curSteamId.Equals(name)) { return("player;steam=" + curSteamId + ";"); } } return(null); }
static void Main(string[] args) { ServiceImpl sevice = new ServiceImpl(); SKMain.Main_Service_Console <ServiceImpl>(sevice.StartCustomService, sevice.StopCustomService); }
static void Main(string[] args) { SKMain.Main_Service_Console <SKFlickrSyncService>(); }
/// <summary> /// Initializes a new instance of the <see cref="SurvivalKit.Permissions.PlayerCommandSender"/> class able to be used as a <see cref="SurvivalKit.Permissions.CommandSender"/>. /// </summary> /// <param name="sender">The player this CommandSender instance should represent.</param> /// <param name="networkPlayer">The NetworkPlayer used to send messages back.</param> public PlayerCommandSender(EntityPlayer sender, UnityEngine.NetworkPlayer networkPlayer) { this.sender = sender; this.networkPlayer = networkPlayer; fullName = ("player;steam=" + SKMain.getClientInfo(networkPlayer).playerId + ";"); }
static void Main(string[] args) { SKMain.Main_Service_Console <ServiceImpl>(); }