コード例 #1
0
        /// <summary>
        /// Calls this method on all mods
        /// </summary>
        /// <param name="moddedEvent"></param>
        public override void OnMultiplayerEventReceived(GenericStringForModdingEvent moddedEvent)
        {
            List <Mod> mods = ModsManager.Instance.GetAllLoadedMods();

            for (int i = 0; i < mods.Count; i++)
            {
                mods[i].OnMultiplayerEventReceived(moddedEvent);
            }
        }
コード例 #2
0
        static void sendEvent(GenericStringForModdingEvent myEvent, string message)
        {
            if (message.Length > 1024)
            {
                throw new Exception("Error sending modded string event: Attempted to send a message that is too long, messages cannot exceed 1024 characters in length");
            }

            myEvent.EventData = message;
            myEvent.Send();
        }
コード例 #3
0
        /// <summary>
        /// Called when we recive a modded event
        /// </summary>
        /// <param name="moddedEvent"></param>
        internal void OnEvent(GenericStringForModdingEvent moddedEvent)
        {
            string message = moddedEvent.EventData;

            if (message.StartsWith(CLIENT_CONNECTED_PREFIX))
            {
                string playfabID = message.Substring(CLIENT_CONNECTED_PREFIX.Length);
                onClientConnectedMessageRecived(playfabID);
            }
            else if (message.StartsWith(BROADCAST_PLAYFAB_ID_PREFIX))
            {
                string playfabID = message.Substring(BROADCAST_PLAYFAB_ID_PREFIX.Length);
                onPlayfabIDBroadcastMessageRecived(playfabID);
            }
        }
コード例 #4
0
ファイル: ModSharingManager.cs プロジェクト: fyrkantis/ModBot
        /// <summary>
        /// Called when the client recives a GenericStringForModdingEvent event
        /// </summary>
        /// <param name="moddingEvent"></param>
        public void OnModdedEvent(GenericStringForModdingEvent moddingEvent)
        {
            string[] messageInfo = moddingEvent.EventData.Split(SEPERATOR_CHAR);

            if (messageInfo.Length != 7 || messageInfo[0] != MESSAGE_PREFIX)
            {
                return;
            }

            int    amountOfMessagesToSend = Convert.ToInt32(messageInfo[1]);
            string id              = messageInfo[2];
            int    index           = Convert.ToInt32(messageInfo[3]);
            string senderPlayfabId = messageInfo[4];
            string modName         = messageInfo[5];
            string data            = messageInfo[6];

            addToDownloadedData(id, index, amountOfMessagesToSend, data, senderPlayfabId, modName);
        }
コード例 #5
0
        /// <summary>
        /// Sends the given <paramref name="message"/> to the given <see cref="GlobalTargets"/>
        /// </summary>
        /// <param name="message"></param>
        /// <param name="targets"></param>
        public static void SendToAllClients(string message, GlobalTargets targets)
        {
            GenericStringForModdingEvent genericStringForModdingEvent = GenericStringForModdingEvent.Create(targets);

            sendEvent(genericStringForModdingEvent, message);
        }
コード例 #6
0
ファイル: Mod.cs プロジェクト: fyrkantis/ModBot
 /// <summary>
 /// Called whenever we received a <see cref="GenericStringForModdingEvent"/> from a client (including your own if you used <see cref="MultiplayerMessageSender.SendToAllClients(string)"/>)
 /// </summary>
 /// <param name="moddedEvent">The received <see cref="GenericStringForModdingEvent"/></param>
 public virtual void OnMultiplayerEventReceived(GenericStringForModdingEvent moddedEvent)
 {
 }
コード例 #7
0
 /// <summary>
 /// Called when we recieve a <see cref="GenericStringForModdingEvent"/>
 /// </summary>
 /// <param name="evnt"></param>
 public override void OnEvent(GenericStringForModdingEvent evnt)
 {
     ModSharingManager.Instance.OnModdedEvent(evnt);
     ModBotUserIdentifier.Instance.OnEvent(evnt);
     ModsManager.Instance.PassOnMod.OnMultiplayerEventReceived(evnt);
 }