示例#1
0
        private void AutoloadModWorld(Type type)
        {
            ModWorld modWorld = (ModWorld)Activator.CreateInstance(type);

            modWorld.mod = this;
            string name = type.Name;

            if (modWorld.Autoload(ref name))
            {
                AddModWorld(name, modWorld);
            }
        }
示例#2
0
 private static bool SendCustomData(ModWorld modWorld, BinaryWriter writer)
 {
     byte[] data;
     using (MemoryStream stream = new MemoryStream())
     {
         using (BinaryWriter customWriter = new BinaryWriter(stream))
         {
             modWorld.SendCustomData(customWriter);
             customWriter.Flush();
             data = stream.ToArray();
         }
     }
     if (data.Length > 0)
     {
         writer.Write(modWorld.mod.Name);
         writer.Write(modWorld.Name);
         writer.Write((ushort)data.Length);
         writer.Write(data);
         return(true);
     }
     return(false);
 }
示例#3
0
		private static bool SendCustomData(ModWorld modWorld, BinaryWriter writer)
		{
			byte[] data;
			using (MemoryStream stream = new MemoryStream())
			{
				using (BinaryWriter customWriter = new BinaryWriter(stream))
				{
					modWorld.SendCustomData(customWriter);
					customWriter.Flush();
					data = stream.ToArray();
				}
			}
			if (data.Length > 0)
			{
				writer.Write(modWorld.mod.Name);
				writer.Write(modWorld.Name);
				writer.Write((ushort)data.Length);
				writer.Write(data);
				return true;
			}
			return false;
		}
示例#4
0
 internal static void Add(ModWorld modWorld)
 {
     worlds.Add(modWorld);
 }
示例#5
0
		internal static void Add(ModWorld modWorld)
		{
			worlds.Add(modWorld);
		}
示例#6
0
		public void AddModWorld(string name, ModWorld modWorld)
		{
			modWorld.Name = name;
			worlds[name] = modWorld;
			modWorld.mod = this;
			WorldHooks.Add(modWorld);
		}