public static string AddCustomAmmoType(string name, string ammoTypeSpritePath, string ammoBackgroundSpritePath)
        {
            Texture2D fgTexture = ResourceExtractor.GetTextureFromResource(ammoTypeSpritePath + ".png");
            Texture2D bgTexture = ResourceExtractor.GetTextureFromResource(ammoBackgroundSpritePath + ".png");

            GameObject fgSpriteObject = new GameObject("sprite fg");

            fgSpriteObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(fgSpriteObject);
            UnityEngine.Object.DontDestroyOnLoad(fgSpriteObject);
            GameObject bgSpriteObject = new GameObject("sprite bg");

            bgSpriteObject.SetActive(false);
            FakePrefab.MarkAsFakePrefab(bgSpriteObject);
            UnityEngine.Object.DontDestroyOnLoad(bgSpriteObject);

            dfTiledSprite  fgSprite   = fgSpriteObject.SetupDfSpriteFromTexture <dfTiledSprite>(fgTexture, ShaderCache.Acquire("Daikon Forge/Default UI Shader"));
            dfTiledSprite  bgSprite   = bgSpriteObject.SetupDfSpriteFromTexture <dfTiledSprite>(bgTexture, ShaderCache.Acquire("Daikon Forge/Default UI Shader"));
            GameUIAmmoType uiammotype = new GameUIAmmoType
            {
                ammoBarBG      = bgSprite,
                ammoBarFG      = fgSprite,
                ammoType       = GameUIAmmoType.AmmoType.CUSTOM,
                customAmmoType = name
            };

            CustomClipAmmoTypeToolbox.addedAmmoTypes.Add(uiammotype);
            foreach (GameUIAmmoController uiammocontroller in GameUIRoot.Instance.ammoControllers)
            {
                Add(ref uiammocontroller.ammoTypes, uiammotype);
            }
            return(name);
        }
Esempio n. 2
0
 public static void SetupEntry(this AIActor enemy, string shortDesc, string longDesc, string portrait, string AmmonomiconSprite, string EnemyName)
 {
     SpriteBuilder.AddSpriteToCollection(AmmonomiconSprite, ammonomiconCollection);
     if (enemy.GetComponent <EncounterTrackable>() != null)
     {
         UnityEngine.Object.Destroy(enemy.GetComponent <EncounterTrackable>());
     }
     enemy.encounterTrackable               = enemy.gameObject.AddComponent <EncounterTrackable>();
     enemy.encounterTrackable.journalData   = new JournalEntry();
     enemy.encounterTrackable.EncounterGuid = enemy.EnemyGuid;
     enemy.encounterTrackable.prerequisites = new DungeonPrerequisite[0];
     enemy.encounterTrackable.journalData.SuppressKnownState    = false;
     enemy.encounterTrackable.journalData.IsEnemy               = true;
     enemy.encounterTrackable.journalData.SuppressInAmmonomicon = false;
     enemy.encounterTrackable.journalData.AmmonomiconSprite     = AmmonomiconSprite;
     enemy.encounterTrackable.journalData.enemyPortraitSprite   = ResourceExtractor.GetTextureFromResource(portrait + ".png");
     enemy.encounterTrackable.ProxyEncounterGuid = "";
     Strings.Enemies.Set("#" + EnemyName.ToUpper(), EnemyName);
     Strings.Enemies.Set("#" + shortDesc.ToUpper(), shortDesc);
     Strings.Enemies.Set("#" + longDesc.ToUpper(), longDesc);
     enemy.encounterTrackable.journalData.PrimaryDisplayName           = "#" + EnemyName.ToUpper();
     enemy.encounterTrackable.journalData.NotificationPanelDescription = "#" + shortDesc.ToUpper();
     enemy.encounterTrackable.journalData.AmmonomiconFullEntry         = "#" + longDesc.ToUpper();
     enemy.encounterTrackable.journalData.SuppressKnownState           = false;
 }
Esempio n. 3
0
        // Token: 0x06000004 RID: 4 RVA: 0x00002190 File Offset: 0x00000390
        public static int AddSpriteToCollection(string resourcePath, tk2dSpriteCollectionData collection)
        {
            string str = (!resourcePath.EndsWith(".png")) ? ".png" : "";

            resourcePath += str;
            Texture2D            textureFromResource  = ResourceExtractor.GetTextureFromResource(resourcePath);
            tk2dSpriteDefinition tk2dSpriteDefinition = SpriteBuilder.ConstructDefinition(textureFromResource);

            tk2dSpriteDefinition.name = textureFromResource.name;
            return(SpriteBuilder.AddSpriteToCollection(tk2dSpriteDefinition, collection));
        }
        /// <summary>
        /// Adds a sprite (from a resource) to a collection
        /// </summary>
        /// <returns>The spriteID of the defintion in the collection</returns>
        public static int AddSpriteToCollection(string resourcePath, tk2dSpriteCollectionData collection)
        {
            string extension = !resourcePath.EndsWith(".png") ? ".png" : "";

            resourcePath += extension;
            var texture = ResourceExtractor.GetTextureFromResource(resourcePath); //Get Texture

            var definition = ConstructDefinition(texture);                        //Generate definition

            definition.name = texture.name;                                       //naming the definition is actually extremely important
            return(AddSpriteToCollection(definition, collection));
        }
Esempio n. 5
0
        /// <summary>
        /// Returns an object with a tk2dSprite component with the
        /// texture of an embedded resource
        /// </summary>
        public static GameObject SpriteFromResource(string spriteName, GameObject obj = null, bool copyFromExisting = true)
        {
            string extension    = !spriteName.EndsWith(".png") ? ".png" : "";
            string resourcePath = spriteName + extension;

            var texture = ResourceExtractor.GetTextureFromResource(resourcePath);

            if (texture == null)
            {
                return(null);
            }

            return(SpriteFromTexture(texture, resourcePath, obj, copyFromExisting));
        }
Esempio n. 6
0
        // Token: 0x06000002 RID: 2 RVA: 0x00002098 File Offset: 0x00000298
        public static GameObject SpriteFromResource(string spriteName, GameObject obj = null, bool copyFromExisting = true)
        {
            string     str  = (!spriteName.EndsWith(".png")) ? ".png" : "";
            string     text = spriteName + str;
            Texture2D  textureFromResource = ResourceExtractor.GetTextureFromResource(text);
            bool       flag = textureFromResource == null;
            GameObject result;

            if (flag)
            {
                result = null;
            }
            else
            {
                result = SpriteBuilder.SpriteFromTexture(textureFromResource, text, obj, copyFromExisting);
            }
            return(result);
        }