Exemple #1
0
            public PMDFormat(BinaryReader bin, GameObject caller, string path)
            {
                EntryPathes(path);

                this.caller = caller;

                try {
                    this.head              = new Header(bin);
                    this.vertex_list       = new VertexList(bin);
                    this.face_vertex_list  = new FaceVertexList(bin);
                    this.material_list     = new MaterialList(bin);
                    this.bone_list         = new BoneList(bin);
                    this.ik_list           = new IKList(bin); read_count++;
                    this.skin_list         = new SkinList(bin); read_count++;
                    this.skin_name_list    = new SkinNameList(bin);
                    this.bone_name_list    = new BoneNameList(bin);
                    this.bone_display_list = new BoneDisplayList(bin);
                    this.eg_head           = new EnglishHeader(bin);
                    if (this.eg_head.english_name_compatibility != 0)
                    {
                        this.eg_bone_name_list    = new EnglishBoneNameList(bin, bone_list.bone_count);
                        this.eg_skin_name_list    = new EnglishSkinNameList(bin, skin_list.skin_count);
                        this.eg_bone_display_list = new EnglishBoneDisplayList(bin, bone_name_list.bone_disp_name_count);
                    }
                    this.toon_texture_list    = new ToonTextureList(bin);
                    this.rigidbody_list       = new RigidbodyList(bin);
                    this.rigidbody_joint_list = new RigidbodyJointList(bin);
                } catch {
                    Debug.Log("Don't read full format");
                }
            }
Exemple #2
0
		public Skin(Manager manager, string name)
			: base(manager) {
			this.name = name;
			content = new ArchiveManager(Manager.Game.Services, GetArchiveLocation(name + Manager.SkinExtension));
			content.RootDirectory = GetFolder();
			doc = new SkinXmlDocument();
			controls = new SkinList<SkinControl>();
			fonts = new SkinList<SkinFont>();
			images = new SkinList<SkinImage>();
			cursors = new SkinList<SkinCursor>();
			attributes = new SkinList<SkinAttribute>();

			LoadSkin(null, content.UseArchive);

			string folder = GetAddonsFolder();
			if (folder == "") {
				content.UseArchive = true;
				folder = "Addons\\";
			} else {
				content.UseArchive = false;
			}

			string[] addons = content.GetDirectories(folder);

			if (addons != null && addons.Length > 0) {
				for (int i = 0; i < addons.Length; i++) {
					DirectoryInfo d = new DirectoryInfo(GetAddonsFolder() + addons[i]);
					if (!((d.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) || content.UseArchive) {
						LoadSkin(addons[i].Replace("\\", ""), content.UseArchive);
					}
				}
			}
		}
Exemple #3
0
        private async void ChatInterface_OnCommandInvoked(string command, string data, Impostor.Api.Events.Player.IPlayerChatEvent source)
        {
            if (source == null || source.ClientPlayer.Character == null)
            {
                return;
            }
            if (source.ClientPlayer.Game.GameState == GameStates.Started)
            {
                if (!Config.AllowInGame)
                {
                    return;
                }
            }
            try
            {
                switch (command)
                {
                case Constants.PlayerCommands.FashionCommand:
                {
                    if (string.IsNullOrEmpty(data))
                    {
                        PluginBase.ChatInterface.SafeMultiMessage(source.Game, Help, Structures.BroadcastType.Error, destination: source.ClientPlayer);
                        return;
                    }
                    else if (data.Equals("new") && Config.AllowRandomSkins)
                    {
                        var randomSkin = Skin.GetRandomSkin(SkinProvider);
                        await source.ClientPlayer.Character.SetSkinAsync(randomSkin.Clothes).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetHatAsync(randomSkin.Hat).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetPetAsync(randomSkin.Pet).ConfigureAwait(false);
                    }

                    else if (SkinList.ContainsKey(data) && Config.AllowPreSetSkins)
                    {
                        var skin = SkinList[data];
                        await source.ClientPlayer.Character.SetSkinAsync(skin.Clothes).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetHatAsync(skin.Hat).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetPetAsync(skin.Pet).ConfigureAwait(false);
                    }
                    else
                    {
                        PluginBase.ChatInterface.SafeMultiMessage(source.Game, "Invalid skin.", Structures.BroadcastType.Error, destination: source.ClientPlayer);
                    }
                    break;
                }
                }
            }
            catch (Exception e)
            {
                PluginBase.LogManager.LogError("Fashion: " + e.Message, Shared.ErrorLocation.Plugin);
            }
        }
Exemple #4
0
 /// <summary>
 /// Initialization of skins for Window.
 /// </summary>
 public void InitializeSkin()
 {
     foreach (var sfSkinManager in Enum.GetNames(typeof(VisualStyles)))
     {
         SkinList.Add(new Model()
         {
             Skins = sfSkinManager.ToString()
         });
     }
 }
Exemple #5
0
		public SkinControl(SkinControl source)
			: base(source) {
			this.Inherits = source.Inherits;
			this.DefaultSize = source.DefaultSize;
			this.MinimumSize = source.MinimumSize;
			this.OriginMargins = source.OriginMargins;
			this.ClientMargins = source.ClientMargins;
			this.ResizerSize = source.ResizerSize;
			this.Layers = new SkinList<SkinLayer>(source.Layers);
			this.Attributes = new SkinList<SkinAttribute>(source.Attributes);
		}
Exemple #6
0
 public PageSkin(string heroname)
 {
     InitializeComponent();
     SkinOperation.Visibility = Visibility.Hidden;
     SkinComment.Visibility   = Visibility.Hidden;
     _soft.SkinP = this;
     _heroName   = heroname;
     SkinList.AddHandler(MouseWheelEvent, new MouseWheelEventHandler(SkinList_MouseWheel), true);
     _soft.SetBackImage(heroname);
     UpdateSkinList();
 }
Exemple #7
0
 public VMDFormat(BinaryReader bin, string path, string clip_name)
 {
     try
     {
         this.clip_name = clip_name;
         header         = new Header(bin);
         read_count++;
         motion_list = new MotionList(bin);
         read_count++;
         skin_list = new SkinList(bin);
         read_count++;
         camera_list = new CameraList(bin);
         read_count++;
         light_list = new LightList(bin);
         read_count++;
         self_shadow_list = new SelfShadowList(bin);
         read_count++;
     }
     catch (EndOfStreamException ex)
     {
         Debug.Log((object)ex.Message);
         if (read_count <= 0)
         {
             header = null;
         }
         if (read_count <= 1 || motion_list.motion_count == 0)
         {
             motion_list = null;
         }
         if (read_count <= 2 || skin_list.skin_count == 0)
         {
             skin_list = null;
         }
         if (read_count <= 3 || camera_list.camera_count == 0)
         {
             camera_list = null;
         }
         if (read_count <= 4 || light_list.light_count == 0)
         {
             light_list = null;
         }
         if (read_count <= 5 || self_shadow_list.self_shadow_count == 0)
         {
             self_shadow_list = null;
         }
     }
 }
Exemple #8
0
		public SkinLayer(SkinLayer source)
			: base(source) {
			if (source != null) {
				this.Image = new SkinImage(source.Image);
				this.Width = source.Width;
				this.Height = source.Height;
				this.OffsetX = source.OffsetX;
				this.OffsetY = source.OffsetY;
				this.Alignment = source.Alignment;
				this.SizingMargins = source.SizingMargins;
				this.ContentMargins = source.ContentMargins;
				this.States = source.States;
				this.Overlays = source.Overlays;
				this.Text = new SkinText(source.Text);
				this.Attributes = new SkinList<SkinAttribute>(source.Attributes);
			} else {
				throw new Exception("Parameter for SkinLayer copy constructor cannot be null.");
			}
		}
Exemple #9
0
 public VMDFormat(BinaryReader bin, string path, string clip_name)
 {
     // 読み込み失敗した場合はだいたいデータがない
     // 失敗しても読み込み続けることがあるので例外でキャッチして残りはnullにしておく
     try {
         this.clip_name        = clip_name;
         this.header           = new MMD.VMD.VMDFormat.Header(bin); read_count++;
         this.motion_list      = new MMD.VMD.VMDFormat.MotionList(bin); read_count++;
         this.skin_list        = new MMD.VMD.VMDFormat.SkinList(bin); read_count++;
         this.camera_list      = new MMD.VMD.VMDFormat.CameraList(bin); read_count++;
         this.light_list       = new MMD.VMD.VMDFormat.LightList(bin); read_count++;
         this.self_shadow_list = new MMD.VMD.VMDFormat.SelfShadowList(bin); read_count++;
     } catch (EndOfStreamException e) {
         Debug.Log(e.Message);
         if (read_count <= 0)
         {
             this.header = null;
         }
         if (read_count <= 1 || this.motion_list.motion_count <= 0)
         {
             this.motion_list = null;
         }
         if (read_count <= 2 || this.skin_list.skin_count <= 0)
         {
             this.skin_list = null;
         }
         if (read_count <= 3 || this.camera_list.camera_count <= 0)
         {
             this.camera_list = null;
         }
         if (read_count <= 4 || this.light_list.light_count <= 0)
         {
             this.light_list = null;
         }
         if (read_count <= 5 || this.self_shadow_list.self_shadow_count <= 0)
         {
             this.self_shadow_list = null;
         }
     }
 }
			public VMDFormat(BinaryReader bin, string path, string clip_name)
			{
				// 読み込み失敗した場合はだいたいデータがない
				// 失敗しても読み込み続けることがあるので例外でキャッチして残りはnullにしておく
				try {
					this.clip_name = clip_name;
					this.header = new MMD.VMD.VMDFormat.Header(bin); read_count++;
					this.motion_list = new MMD.VMD.VMDFormat.MotionList(bin); read_count++;
					this.skin_list = new MMD.VMD.VMDFormat.SkinList(bin); read_count++;
					this.camera_list = new MMD.VMD.VMDFormat.CameraList(bin); read_count++;
					this.light_list = new MMD.VMD.VMDFormat.LightList(bin); read_count++;
					this.self_shadow_list = new MMD.VMD.VMDFormat.SelfShadowList(bin); read_count++;
				} catch (EndOfStreamException e) {
					Debug.Log(e.Message);
					if (read_count <= 0)
						this.header = null;
					if (read_count <= 1 || this.motion_list.motion_count <= 0)
						this.motion_list = null;
					if (read_count <= 2 || this.skin_list.skin_count <= 0)
						this.skin_list = null;
					if (read_count <= 3 || this.camera_list.camera_count <= 0)
						this.camera_list = null;
					if (read_count <= 4 || this.light_list.light_count <= 0)
						this.light_list = null;
					if (read_count <= 5 || this.self_shadow_list.self_shadow_count <= 0) 
						this.self_shadow_list = null;
				}
			}
			public PMDFormat(BinaryReader bin, GameObject caller, string path)
			{
				EntryPathes(path);
				
				this.caller = caller;
				
				try {
					this.head = new Header(bin);
					this.vertex_list = new VertexList(bin);
					this.face_vertex_list = new FaceVertexList(bin);
					this.material_list = new MaterialList(bin);
					this.bone_list = new BoneList(bin); 
					this.ik_list = new IKList(bin); read_count++;
					this.skin_list = new SkinList(bin); read_count++;
					this.skin_name_list = new SkinNameList(bin);
					this.bone_name_list = new BoneNameList(bin);
					this.bone_display_list = new BoneDisplayList(bin);
					this.eg_head = new EnglishHeader(bin);
					if (this.eg_head.english_name_compatibility != 0)
					{
						this.eg_bone_name_list = new EnglishBoneNameList(bin, bone_list.bone_count);
						this.eg_skin_name_list = new EnglishSkinNameList(bin, skin_list.skin_count);
						this.eg_bone_display_list = new EnglishBoneDisplayList(bin, bone_name_list.bone_disp_name_count);
					}
					this.toon_texture_list = new ToonTextureList(bin);
					this.rigidbody_list = new RigidbodyList(bin);
					this.rigidbody_joint_list = new RigidbodyJointList(bin);
				} catch {
					Debug.Log("Don't read full format");
				}
			}