コード例 #1
0
        public override void Init(AvaliGraphicRequest req)
        {
            this.data = req.graphicData;
            if (req.path.NullOrEmpty())
            {
                throw new ArgumentNullException("folderPath");
            }
            if ((UnityEngine.Object)req.shader == (UnityEngine.Object)null)
            {
                throw new ArgumentNullException("shader");
            }
            this.path     = req.path;
            this.color    = req.color;
            this.colorTwo = req.colorTwo;
            this.drawSize = req.drawSize;
            List <Texture2D> list = ContentFinder <Texture2D> .GetAllInFolder(req.path).Where <Texture2D>((Func <Texture2D, bool>)(x => !x.name.EndsWith(Graphic_Single.MaskSuffix))).OrderBy <Texture2D, string>((Func <Texture2D, string>)(x => x.name)).ToList <Texture2D>();

            if (list.NullOrEmpty <Texture2D>())
            {
                Log.Error("Collection cannot init: No textures found at path " + req.path, false);
                this.subGraphics = new AvaliGraphic[1]
                {
                    AvaliBaseContent.BadGraphic
                };
            }
            else
            {
                this.subGraphics = new AvaliGraphic[list.Count];
                for (int index = 0; index < list.Count; ++index)
                {
                    string path = req.path + "/" + list[index].name;
                    this.subGraphics[index] = AvaliGraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, this.drawSize, this.color, this.colorTwo, this.colorThree, (AvaliGraphicData)null, req.shaderParameters);
                }
            }
        }
コード例 #2
0
        public override void Init(AvaliGraphicRequest req)
        {
            this.data     = req.graphicData;
            this.path     = req.path;
            this.color    = req.color;
            this.drawSize = req.drawSize;
            List <StuffAppearanceDef> defsListForReading = DefDatabase <StuffAppearanceDef> .AllDefsListForReading;

            this.subGraphics = new AvaliGraphic[defsListForReading.Count];
            for (int index = 0; index < this.subGraphics.Length; ++index)
            {
                StuffAppearanceDef stuffAppearance = defsListForReading[index];
                string             folderPath      = req.path;
                if (!stuffAppearance.pathPrefix.NullOrEmpty())
                {
                    folderPath = stuffAppearance.pathPrefix + "/" + ((IEnumerable <string>)folderPath.Split('/')).Last <string>();
                }
                Texture2D texture2D = ContentFinder <Texture2D> .GetAllInFolder(folderPath).Where <Texture2D>((Func <Texture2D, bool>)(x => x.name.EndsWith(stuffAppearance.defName))).FirstOrDefault <Texture2D>();

                if ((UnityEngine.Object)texture2D != (UnityEngine.Object)null)
                {
                    this.subGraphics[index] = AvaliGraphicDatabase.Get <AvaliGraphic_Single>(folderPath + "/" + texture2D.name, req.shader, this.drawSize, this.color);
                }
            }
            for (int index = 0; index < this.subGraphics.Length; ++index)
            {
                if (this.subGraphics[index] == null)
                {
                    this.subGraphics[index] = this.subGraphics[(int)StuffAppearanceDefOf.Smooth.index];
                }
            }
        }
コード例 #3
0
 void CreateGraphics()
 {
     if (this.graphicData.graphicClass == typeof(Graphic_Random) || this.graphicData.graphicClass == typeof(Graphic_Flicker))
     {
         for (int i = 0; i < textures.Count; i++)
         {
             List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(textures[i])
                                      where !x.name.EndsWith(Graphic_Single.MaskSuffix)
                                      orderby x.name
                                      select x).ToList <Texture2D>();
             if (list.NullOrEmpty <Texture2D>())
             {
                 Log.Error("Collection cannot init: No textures found at path " + textures[i], false);
             }
             for (int ii = 0; ii < list.Count; ii++)
             {
                 materials.Add(MaterialPool.MatFrom(textures[i] + "/" + list[ii].name, ShaderDatabase.TransparentPostLight));
             }
         }
     }
     else
     {
         for (int i = 0; i < textures.Count; i++)
         {
             materials.Add(MaterialPool.MatFrom(textures[i], ShaderDatabase.TransparentPostLight));
         }
     }
 }
コード例 #4
0
        static Resources()
        {
            SlightlyDarkBackground = new Color(0f, 0f, 0f, .2f);
            Close = ContentFinder <Texture2D> .Get("UI/Icons/Close");

            EyeOpen = ContentFinder <Texture2D> .Get("UI/Icons/EyeOpen");

            EyeClosed = ContentFinder <Texture2D> .Get("UI/Icons/EyeClosed");

            Search = ContentFinder <Texture2D> .Get("UI/Icons/Search");

            Steam = ContentFinder <Texture2D> .Get("UI/Icons/ContentSources/SteamWorkshop");

            Ludeon = ContentFinder <Texture2D> .Get("UI/Icons/Ludeon");

            File = ContentFinder <Texture2D> .Get("UI/Icons/File");

            Folder = ContentFinder <Texture2D> .Get("UI/Icons/ContentSources/LocalFolder");

            Warning = ContentFinder <Texture2D> .Get("UI/Icons/Warning");

            Question = ContentFinder <Texture2D> .Get("UI/Icons/Question");

            Status_Cross = ContentFinder <Texture2D> .Get("UI/Icons/Status/Cross");

            Status_Down = ContentFinder <Texture2D> .Get("UI/Icons/Status/Down");

            Status_Up = ContentFinder <Texture2D> .Get("UI/Icons/Status/Up");

            Status_Plus = ContentFinder <Texture2D> .Get("UI/Icons/Status/Plus");

            Spinner = ContentFinder <Texture2D> .GetAllInFolder("UI/Icons/Spinner").ToArray();
        }
コード例 #5
0
 public override IEnumerable <ResolvedGrain> GetResolvedGrains()
 {
     foreach (AudioClip folderClip in ContentFinder <AudioClip> .GetAllInFolder(this.clipFolderPath))
     {
         yield return(new ResolvedGrain_Clip(folderClip));
     }
 }
コード例 #6
0
        public StatDef ResistHediffStat = null;  //The default chance of adding a hediff.

        void CreateGraphics()
        {
            if (this.graphicData.graphicClass == typeof(Graphic_Random) || this.graphicData.graphicClass == typeof(Graphic_Flicker))
            {
                for (int i = 0; i < textures.Count; i++)
                {
                    List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(textures[i])
                                             where !x.name.EndsWith(Graphic_Single.MaskSuffix)
                                             orderby x.name
                                             select x).ToList <Texture2D>();
                    if (list.NullOrEmpty <Texture2D>())
                    {
                        Log.Error("Collection cannot init: No textures found at path " + textures[i], false);
                    }
                    for (int ii = 0; ii < list.Count; ii++)
                    {
                        materials.Add(MaterialPool.MatFrom(textures[i] + "/" + list[ii].name, this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam));
                    }
                }
            }
            else
            {
                for (int i = 0; i < textures.Count; i++)
                {
                    materials.Add(MaterialPool.MatFrom(textures[i], this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam));
                }
            }
            if (!flareMatPath.NullOrEmpty())
            {
                flareMat = MaterialPool.MatFrom(flareMatPath, this.flareShaderType?.Shader ?? this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam);
            }
        }
コード例 #7
0
        public override void Init(GraphicRequestRGB req, bool cacheResults = true)
        {
            if (cacheResults is true)
            {
                masks           = new Texture2D[MatCount];
                maskMatPatterns = new Dictionary <PatternDef, Pair <string, Material[]> >();
            }
            data       = req.graphicData;
            path       = req.path;
            color      = req.color;
            colorTwo   = req.colorTwo;
            colorThree = req.colorThree;
            tiles      = req.tiles;
            drawSize   = req.drawSize;
            var files = ContentFinder <Texture2D> .GetAllInFolder(req.path);

            List <Texture2D> list = (from x in files
                                     where !x.name.EndsWith(MaskSuffix)
                                     orderby x.name
                                     select x).ToList();
            List <Texture2D> listM = (from x in files
                                      where x.name.EndsWith(MaskSuffix)
                                      orderby x.name
                                      select x).ToList();

            if (list.NullOrEmpty())
            {
                Log.Error("Collection cannot init: No textures found at path " + req.path);
                graphicPaths = new string[]
                {
                    BaseContent.BadGraphic.path
                };
                return;
            }
            graphicPaths = new string[list.Count];
            subGraphics  = new Graphic_Cannon[list.Count];
            subTextures  = list.ToArray();
            if (list.Count != listM.Count && !listM.NullOrEmpty())
            {
                Log.Error($"{VehicleHarmony.LogLabel} Could not apply masks for animation classes at path {req.path}. " +
                          $"Mask and texture count do not match up." +
                          $"\nMainTextures: {list.Count} Masks: {listM.Count}");
                graphicPaths = new string[]
                {
                    BaseContent.BadGraphic.path
                };
                return;
            }
            for (int i = 0; i < list.Count; i++)
            {
                string fullPath = string.Concat(req.path, '/', list[i].name);
                graphicPaths[i] = fullPath;
                subGraphics[i]  = GraphicDatabaseRGB.Get <Graphic_Cannon>(fullPath, req.shader, req.drawSize, req.color, req.colorTwo, req.colorThree, req.tiles,
                                                                          req.displacement.x, req.displacement.y, DataRGB, req.shaderParameters) as Graphic_Cannon;
            }
        }
コード例 #8
0
    void Start()
    {
        List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder("World/Hills") orderby x.name select x).ToList();

        Debug.Log("TestLength>>>" + list.Count);
        string src = Application.dataPath + "/Test/Textures";

        directoryInfo = new DirectoryInfo(src);
        files         = directoryInfo.GetFiles();
    }
コード例 #9
0
        static TexLoad()
        {
            var icons = ContentFinder <Texture2D> .GetAllInFolder("FactionIcons");

            factionIcons = icons.ToList();
            if (factionIcons.NullOrEmpty())
            {
                Log.Error("Empire - No faction icons found, will probably result in Empire not working properly.");
            }
        }
コード例 #10
0
        public override void Init(GraphicRequest req)
        {
            this.data = req.graphicData;
            if (req.path.NullOrEmpty())
            {
                throw new ArgumentNullException("folderPath");
            }
            if (req.shader == null)
            {
                throw new ArgumentNullException("shader");
            }
            this.path     = req.path;
            this.color    = req.color;
            this.colorTwo = req.colorTwo;
            this.drawSize = req.drawSize;
            int idx = this.path.LastIndexOf('/');

            if (idx != -1)
            {
                //	string s1 = this.path.Substring(0, idx);
                //	Log.Message(s1);
                string s2 = this.path.Substring(idx + 1);
                //	Log.Message(s2);

                this.path = req.path + "/" + s2;
                //	Log.Message(path);
            }
            // Regex.Match(test, @"^[^0-9]*").Value
            List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(path)
                                     where Regex.Match(x.name, @"^[^0-9]*").Success&& !x.name.EndsWith(Graphic_AdvancedSingle.MaskSuffix) && !x.name.EndsWith(Graphic_AdvancedSingle.GlowSuffix) && !x.name.EndsWith(Graphic_AdvancedSingle.GlowMaskSuffix) && !x.name.Contains(Graphic_AdvancedMulti.NSuffix) && !x.name.Contains(Graphic_AdvancedMulti.SSuffix) && !x.name.Contains(Graphic_AdvancedMulti.ESuffix) && !x.name.Contains(Graphic_AdvancedMulti.WSuffix)
                                     orderby x.name
                                     select x).ToList <Texture2D>();

            if (list.NullOrEmpty <Texture2D>())
            {
                Log.Error("Collection cannot init: No textures found at path " + path, false);
                this.subGraphics = new Graphic[]
                {
                    BaseContent.BadGraphic
                };
                return;
            }

            //	Log.Message("found " + list.Count()+" Variants");

            this.subGraphics = new Graphic[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                string path = req.path + "/" + list[i].name;
                //	Log.Message("loaded "+ path);
                this.subGraphics[i] = GraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, this.drawSize, this.color, this.colorTwo, this.data, req.shaderParameters);
            }
            this.mat = this.subGraphics[0].MatSingle;
        }
コード例 #11
0
 static PriorityGrid()
 {
     _colors = new[]
     {
         // http://colorbrewer2.org/?type=diverging&scheme=RdBu&n=7 , using the middle 5
         Color255(239, 138, 98),
         Color255(253, 219, 199),
         Color255(255, 255, 255),
         Color255(209, 229, 240),
         Color255(103, 169, 172)
     };
     _priorityIcons = ContentFinder <Texture2D> .GetAllInFolder("UI/Icons/Priorities").ToArray();
 }
コード例 #12
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = ContentFinder <AudioClip> .GetAllInFolder(this.clipFolderPath).GetEnumerator();

                    num = 4294967293u;
                    break;

                case 1u:
                    break;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        folderClip    = enumerator.Current;
                        this.$current = new ResolvedGrain_Clip(folderClip);
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                this.$PC = -1;
                return(false);
            }
コード例 #13
0
        static Resources()
        {
            SortingIcon = ContentFinder <Texture2D> .Get("UI/Icons/Sorting");

            SortingDescendingIcon = ContentFinder <Texture2D> .Get("UI/Icons/SortingDescending");

            MoodHappy = ContentFinder <Texture2D> .Get("UI/Icons/Mood/happy");

            MoodContent = ContentFinder <Texture2D> .Get("UI/Icons/Mood/content");

            MoodDiscontent = ContentFinder <Texture2D> .Get("UI/Icons/Mood/discontent");

            MoodUnhappy = ContentFinder <Texture2D> .Get("UI/Icons/Mood/unhappy");

            MoodBroken = ContentFinder <Texture2D> .Get("UI/Icons/Mood/broken");

            PrioritiesDetailed = ContentFinder <Texture2D> .Get("UI/Icons/numbers");

            PrioritiesSimple = ContentFinder <Texture2D> .Get("UI/Icons/checks");

            PrioritiesTimed = ContentFinder <Texture2D> .Get("UI/Icons/clock-scheduler");

            PrioritiesWholeDay = ContentFinder <Texture2D> .Get("UI/Icons/whole-day");

            PinEye = ContentFinder <Texture2D> .Get("UI/Icons/pin-eye");

            PinClock = ContentFinder <Texture2D> .Get("UI/Icons/pin-clock");

            Clock = ContentFinder <Texture2D> .Get("UI/Icons/clock");

            Half = ContentFinder <Texture2D> .Get("UI/Icons/half");

            Now = ContentFinder <Texture2D> .Get("UI/Icons/now");

            Expand = ContentFinder <Texture2D> .Get("UI/Icons/expand");

            Collapse = ContentFinder <Texture2D> .Get("UI/Icons/collapse");

            LeftArrow = ContentFinder <Texture2D> .Get("UI/Icons/LeftArrow");

            RightArrow = ContentFinder <Texture2D> .Get("UI/Icons/RightArrow");

            StarHollow = ContentFinder <Texture2D> .Get("UI/Icons/star-hollow");

            Star = ContentFinder <Texture2D> .Get("UI/Icons/star");

            Edit = ContentFinder <Texture2D> .Get("UI/Icons/edit");

            Icons = ContentFinder <Texture2D> .GetAllInFolder("UI/Icons/Various").ToArray();
        }
コード例 #14
0
        public override IEnumerable <ResolvedGrain> GetResolvedGrains()
        {
            using (IEnumerator <AudioClip> enumerator = ContentFinder <AudioClip> .GetAllInFolder(this.clipFolderPath).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    AudioClip folderClip = enumerator.Current;
                    yield return((ResolvedGrain) new ResolvedGrain_Clip(folderClip));

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_00c3:
            /*Error near IL_00c4: Unexpected return in MoveNext()*/;
        }
コード例 #15
0
        // Token: 0x06000038 RID: 56 RVA: 0x00002E64 File Offset: 0x00001064
        public static Texture2D GetIcon(ThingDef thingDef)
        {
            Texture2D texture2D = ContentFinder <Texture2D> .Get(thingDef.graphicData.texPath, false);

            if (texture2D == null)
            {
                texture2D = ContentFinder <Texture2D> .GetAllInFolder(thingDef.graphicData.texPath).ToList <Texture2D>()[0];

                if (texture2D == null)
                {
                    texture2D = ContentFinder <Texture2D> .Get("UI/Commands/LaunchReport", true);

                    Log.Warning("Fermenter:: No texture at " + thingDef.graphicData.texPath + ".", false);
                }
            }
            return(texture2D);
        }
コード例 #16
0
        // Try to get a texture of a thingDef; If not found, use LaunchReport icon
        public static Texture2D GetIcon(ThingDef thingDef)
        {
            Texture2D icon = ContentFinder <Texture2D> .Get(thingDef.graphicData.texPath, false);

            if (icon == null)
            {
                // Use the first texture in the folder
                icon = ContentFinder <Texture2D> .GetAllInFolder(thingDef.graphicData.texPath).ToList()[0];

                if (icon == null)
                {
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchReport", true);

                    Log.Warning("Universal Fermenter:: No texture at " + thingDef.graphicData.texPath + ".");
                }
            }
            return(icon);
        }
コード例 #17
0
        static Resources()
        {
            SlightlyDarkBackground = new Color(0f, 0f, 0f, .2f);
            Close = ContentFinder <Texture2D> .Get("UI/Icons/Close");

            EyeOpen = ContentFinder <Texture2D> .Get("UI/Icons/EyeOpen");

            EyeClosed = ContentFinder <Texture2D> .Get("UI/Icons/EyeClosed");

            Search = ContentFinder <Texture2D> .Get("UI/Icons/Search");

            Steam = ContentFinder <Texture2D> .Get("UI/Icons/ContentSources/SteamWorkshop");

            Ludeon = ContentFinder <Texture2D> .Get("UI/Icons/Ludeon");

            File = ContentFinder <Texture2D> .Get("UI/Icons/File");

            Folder = ContentFinder <Texture2D> .Get("UI/Icons/ContentSources/ModsFolder");

            Warning = ContentFinder <Texture2D> .Get("UI/Icons/Warning");

            Question = ContentFinder <Texture2D> .Get("UI/Icons/Question");

            // the joys of case-unaware file systems - I now don't know which version is out there...
            Palette = ContentFinder <Texture2D> .Get("UI/Icons/Palette", false);

            Palette ??= ContentFinder <Texture2D> .Get("UI/Icons/palette");

            Gear = ContentFinder <Texture2D> .Get("UI/Icons/Gear");

            Check = ContentFinder <Texture2D> .Get("UI/Widgets/CheckOn");

            Wand = ContentFinder <Texture2D> .Get("UI/Icons/Wand");

            Status_Cross = ContentFinder <Texture2D> .Get("UI/Icons/Status/Cross");

            Status_Down = ContentFinder <Texture2D> .Get("UI/Icons/Status/Down");

            Status_Up = ContentFinder <Texture2D> .Get("UI/Icons/Status/Up");

            Status_Plus = ContentFinder <Texture2D> .Get("UI/Icons/Status/Plus");

            Spinner = ContentFinder <Texture2D> .GetAllInFolder("UI/Icons/Spinner").ToArray();
        }
コード例 #18
0
        public override void Init(GraphicRequest graphicRequest)
        {
            cachedReq = graphicRequest;
            data      = graphicRequest.graphicData;
            if (graphicRequest.path.NullOrEmpty())
            {
                throw new ArgumentNullException(nameof(graphicRequest.path));
            }

            if (graphicRequest.shader == null)
            {
                throw new ArgumentNullException(nameof(graphicRequest.shader));
            }

            path     = graphicRequest.path;
            color    = graphicRequest.color;
            colorTwo = graphicRequest.colorTwo;
            drawSize = graphicRequest.drawSize;
            var list = (from x in ContentFinder <Texture2D> .GetAllInFolder(graphicRequest.path)
                        where !x.name.EndsWith(Graphic_Single.MaskSuffix)
                        orderby x.name
                        select x).ToList();

            cachedTextures = list;

            if (list.NullOrEmpty())
            {
                Log.Error("Collection cannot init: No textures found at path " + graphicRequest.path);
                subGraphics = new[]
                {
                    BaseContent.BadGraphic
                };
                return;
            }

            subGraphics = new Graphic[list.Count];
            for (var i = 0; i < list.Count; i++)
            {
                var graphicRequestPath = graphicRequest.path + "/" + list[i].name;
                subGraphics[i] = GraphicDatabase.Get(typeof(Graphic_Single), graphicRequestPath, graphicRequest.shader,
                                                     drawSize, color, colorTwo, null, graphicRequest.shaderParameters);
            }
        }
コード例 #19
0
        public override void Init(GraphicRequest req)
        {
            this.data = req.graphicData;
            if (req.path.NullOrEmpty())
            {
                throw new ArgumentNullException("folderPath");
            }
            if (req.shader == null)
            {
                throw new ArgumentNullException("shader");
            }
            this.path     = req.path;
            this.color    = req.color;
            this.colorTwo = req.colorTwo;
            this.drawSize = req.drawSize;
            List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path)
                                     where !x.name.EndsWith(Graphic_AdvancedSingle.MaskSuffix) && !x.name.EndsWith(Graphic_AdvancedSingle.GlowSuffix) && !x.name.EndsWith(Graphic_AdvancedSingle.GlowMaskSuffix) && !x.name.Contains(Graphic_AdvancedMulti.NSuffix) && !x.name.Contains(Graphic_AdvancedMulti.SSuffix) && !x.name.Contains(Graphic_AdvancedMulti.ESuffix) && !x.name.Contains(Graphic_AdvancedMulti.WSuffix)
                                     orderby x.name
                                     select x).ToList <Texture2D>();

            if (list.NullOrEmpty <Texture2D>())
            {
                Log.Error("Collection cannot init: No textures found at path " + req.path, false);
                this.subGraphics = new Graphic[]
                {
                    BaseContent.BadGraphic
                };
                return;
            }
            else
            {
            }
            this.subGraphics = new Graphic[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                string path = req.path + "/" + list[i].name;
                //	Log.Message("loaded "+ path);
                this.subGraphics[i] = GraphicDatabase.Get(typeof(Graphic_Single), path, req.shader, this.drawSize, this.color, this.colorTwo, null, req.shaderParameters);
            }
        }
コード例 #20
0
        public static bool Prefix()
        {
            Vector2 TextureSize = new Vector2(2048f, 1280f);

            bool flag = true;

            if (UI.screenWidth > UI.screenHeight * (TextureSize.x / TextureSize.y))
            {
                flag = false;
            }

            Rect position;

            if (flag)
            {
                float height = UI.screenHeight;
                float num    = UI.screenHeight * (TextureSize.x / TextureSize.y);
                position = new Rect((UI.screenWidth / 2) - num / 2f, 0f, num, height);
            }
            else
            {
                float width = UI.screenWidth;
                float num2  = UI.screenWidth * (TextureSize.y / TextureSize.x);
                position = new Rect(0f, (UI.screenHeight / 2) - num2 / 2f, width, num2);
            }

            if (selectedTexture == null)
            {
                IEnumerable <Texture2D> BackgroundTextures = ContentFinder <Texture2D> .GetAllInFolder("UI/Background");

                selectedTexture = BackgroundTextures.RandomElement();
            }

            GUI.DrawTexture(position, selectedTexture, ScaleMode.ScaleToFit);

            return(false);
        }
コード例 #21
0
        public override void Init(GraphicRequest req)
        {
            this.data = req.graphicData;
            if (req.path.NullOrEmpty())
            {
                throw new ArgumentNullException("folderPath");
            }
            if (req.shader == null)
            {
                throw new ArgumentNullException("shader");
            }
            this.path     = req.path;
            this.color    = req.color;
            this.drawSize = req.drawSize;
            List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(req.path)
                                     where !x.name.EndsWith(Graphic_Single.MaskSuffix) && !this.isMask(x.name)
                                     select x).ToList <Texture2D>();

            if (list.NullOrEmpty <Texture2D>())
            {
                Log.Error("Collection cannot init: No textures found at path " + req.path);
                this.subGraphics = new Graphic[]
                {
                    BaseContent.BadGraphic
                };
                return;
            }
            this.subGraphics = new Graphic[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                string path = req.path + "/" + list[i].name;
                this.subGraphics[i] = GraphicDatabase.Get <Graphic_Single>(path, req.shader, this.drawSize, this.color);
            }
            Texture2D[] array       = new Texture2D[3];
            string      graphicPath = list.RandomElement().name;

            array[1] = ContentFinder <Texture2D> .Get(graphicPath + "_side", false);

            if (array[1] == null)
            {
                array[1] = array[0];
            }
            array[2] = ContentFinder <Texture2D> .Get(graphicPath + "_front", false);

            if (array[2] == null)
            {
                array[2] = array[0];
            }
            Texture2D[] array2 = new Texture2D[3];
            if (req.shader.SupportsMaskTex())
            {
                array2[0] = ContentFinder <Texture2D> .Get(graphicPath + "_backm", false);

                if (array2[0] != null)
                {
                    array2[1] = ContentFinder <Texture2D> .Get(graphicPath + "_sidem", false);

                    if (array2[1] == null)
                    {
                        array2[1] = array2[0];
                    }
                    array2[2] = ContentFinder <Texture2D> .Get(graphicPath + "_frontm", false);

                    if (array2[2] == null)
                    {
                        array2[2] = array2[0];
                    }
                }
            }
            for (int i = 0; i < 3; i++)
            {
                MaterialRequest req2 = default(MaterialRequest);
                req2.mainTex  = array[i];
                req2.shader   = req.shader;
                req2.color    = this.color;
                req2.colorTwo = this.colorTwo;
                req2.maskTex  = array2[i];
                this.mats[i]  = MaterialPool.MatFrom(req2);
            }
            this.path = graphicPath;
        }
コード例 #22
0
ファイル: Resources.cs プロジェクト: fluffy-mods/PowerCleaner
        static Resources()
        {
            SprayIcon = ContentFinder <Texture2D> .Get("UI/Icons/Spray");

            WaterSprites = ContentFinder <Texture2D> .GetAllInFolder("Water").ToArray();
        }
コード例 #23
0
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     base.PostSpawnSetup(respawningAfterLoad);
     this.pb = base.parent as Building_SuperWeapon;
     list    = (ContentFinder <Texture2D> .GetAllInFolder(path)).ToList <Texture2D>();
 }
コード例 #24
0
ファイル: IconMenu.cs プロジェクト: TroyAlias/tacticalgroups
        public void ReInitIcons(string folderName)
        {
            this.groupBannerFolder = folderName;
            var bannerPath = "";

            if (bannerModeEnabled)
            {
                bannerPath = "UI/ColonistBar/GroupIcons/BannerMode/" + groupBannerFolder;
            }
            else
            {
                bannerPath = "UI/ColonistBar/GroupIcons/" + groupBannerFolder;
            }
            var banners = ContentFinder <Texture2D> .GetAllInFolder(bannerPath).OrderBy(x => x.name).ToList();

            bannerStates.Clear();
            foreach (var banner in banners)
            {
                if (this.colonistGroup.groupBanner == banner)
                {
                    bannerStates[banner] = true;
                }
                else
                {
                    bannerStates[banner] = false;
                }
            }

            if (!bannerStates.Where(x => x.Value).Any())
            {
                this.colonistGroup.groupBannerFolder         = this.groupBannerFolder;
                this.colonistGroup.groupBanner               = banners.First();
                this.colonistGroup.groupBannerName           = this.colonistGroup.groupBanner.name;
                bannerStates[this.colonistGroup.groupBanner] = true;
            }

            var iconPath = "";

            if (bannerModeEnabled)
            {
                iconPath = "UI/ColonistBar/GroupIcons/BannerMode/" + groupIconFolder;
            }
            else
            {
                iconPath = "UI/ColonistBar/GroupIcons/" + groupIconFolder;
            }
            var icons = ContentFinder <Texture2D> .GetAllInFolder(iconPath).OrderBy(x => x.name).ToList();

            iconStates.Clear();
            foreach (var icon in icons)
            {
                if (this.colonistGroup.groupIcon == icon)
                {
                    iconStates[icon] = true;
                }
                else
                {
                    iconStates[icon] = false;
                }
            }
            if (!iconStates.Where(x => x.Value).Any())
            {
                this.colonistGroup.groupBannerFolder     = this.groupBannerFolder;
                this.colonistGroup.groupIcon             = icons.First();
                this.colonistGroup.groupIconName         = this.colonistGroup.groupIcon.name;
                iconStates[this.colonistGroup.groupIcon] = true;
            }
        }