コード例 #1
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            hashCode = (hashCode * 397) ^ Name.GetHashCode();
            hashCode = (hashCode * 397) ^ TexturePath.GetHashCode();
            hashCode = (hashCode * 397) ^ Tag.GetHashCode();
            return(hashCode);
        }
コード例 #2
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (TextureName != null ? TextureName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TexturePath != null ? TexturePath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Size.GetHashCode();
         return(hashCode);
     }
 }
コード例 #3
0
        public override string GetTexturePathAt(double time)
        {
            var dotIndex = TexturePath.LastIndexOf('.');

            if (dotIndex < 0)
            {
                return(TexturePath + GetFrameAt(time));
            }

            return(TexturePath.Substring(0, dotIndex) + GetFrameAt(time) + TexturePath.Substring(dotIndex, TexturePath.Length - dotIndex));
        }
コード例 #4
0
        public Texture2D GetTexture(string texturePath, bool common)
        {
            TexturePath tex = _textures.FirstOrDefault(x => x.path == texturePath && (common || x.langCode == TextManager.instance.currentLang.code));

            if (tex == null)
            {
                Debug.LogError(string.Format("No texture for {0} path \"{1}\"", common ? "common" : "", texturePath));
                return(null);
            }
            return(tex.texture);
        }
コード例 #5
0
 protected virtual void WriteHeader(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 {
     writer.Write($"Sprite,{layer},{Origin.ToString()},\"{TexturePath.Trim()}\"");
     if (!moveTimeline.HasCommands && !moveXTimeline.HasCommands)
     {
         writer.Write($",{InitialPosition.X.ToString(exportSettings.NumberFormat)}");
     }
     else
     {
         writer.Write($",0");
     }
     if (!moveTimeline.HasCommands && !moveYTimeline.HasCommands)
     {
         writer.WriteLine($",{InitialPosition.Y.ToString(exportSettings.NumberFormat)}");
     }
     else
     {
         writer.WriteLine($",0");
     }
 }
コード例 #6
0
        public override TreeProfileContent Process(XmlDocument input, ContentProcessorContext context)
        {
            // Build a tree generator just to validate the XML format
            try
            {
                TreeGenerator.CreateFromXml(input);
            }
            catch (ArgumentException ex)
            {
                ErrorInvalidFormat(ex.Message);
            }

            TreeProfileContent content = new TreeProfileContent();

            string path = "";

            if (TexturePath != null && TexturePath != "" && !(TexturePath.EndsWith("/") || TexturePath.EndsWith(@"\")))
            {
                path = TexturePath + "/";
            }
            else if (TexturePath == null)
            {
                path = "";
            }
            else
            {
                path = TexturePath;
            }

            XmlNode treeNode = input.SelectSingleNode("Tree");

            content.GeneratorXML = input;
            content.TrunkTexture = path + GetChildContent(treeNode, "TrunkTexture");
            content.LeafTexture  = path + GetChildContent(treeNode, "LeafTexture");
            content.TrunkEffect  = TrunkEffect;
            content.LeafEffect   = LeafEffect;

            return(content);
        }
コード例 #7
0
 protected override void WriteHeader(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 => writer.WriteLine($"Animation,{layer},{Origin.ToString()},\"{TexturePath.Trim()}\",{InitialPosition.X.ToString(exportSettings.NumberFormat)},{InitialPosition.Y.ToString(exportSettings.NumberFormat)},{FrameCount},{FrameDelay},{LoopType}");