Esempio n. 1
0
 //Adds a new zonetype.
 public static void AddZoneType(string name, string sprite)
 {
     Debug.Log("Attempting to add zonetype with name: " + name);
     if (LuaPowerData.customEnums[typeof(ZoneType)].Contains(name))
     {
         return;
     }
     LuaPowerData.customEnums[typeof(ZoneType)].Add(name);
     S.I.runCtrl.worldBar.zoneSprites.Add(name, LuaPowerSprites.GetSprite(sprite));
     Debug.Log("ZoneType added with name: " + GetZoneType(name).ToString());
 }
Esempio n. 2
0
    public static IEnumerator _SetBrandImage(string name, string sprite, string BGSprite = null)
    {
        while (!LuaPowerData.customEnums[typeof(Brand)].Contains(name))
        {
            yield return(new WaitForSeconds(0f));

            MPLog.Log("ERROR: A Brand does not exist with the name " + name + ".\nTrying again next frame (make a brand with MakeBrand)", LogLevel.Info);
        }
        while (LuaPowerSprites.GetSprite(sprite) == null)
        {
            yield return(new WaitForSeconds(0f));
        }
        while (BGSprite != null && LuaPowerSprites.GetSprite(BGSprite) == null)
        {
            yield return(new WaitForSeconds(0f));
        }
        Array.Resize(ref S.I.deCtrl.brandSprites, Mathf.Max(S.I.deCtrl.brandSprites.Length, LuaPowerData.customEnums[typeof(Brand)].IndexOf(name) + 1));
        S.I.deCtrl.brandSprites[LuaPowerData.customEnums[typeof(Brand)].IndexOf(name)] = LuaPowerSprites.GetSprite(sprite);
        if (S.I.deCtrl.spellBackgroundBrands.Count <= LuaPowerData.customEnums[typeof(Brand)].IndexOf(name))
        {
            while (S.I.deCtrl.spellBackgroundBrands.Count <= LuaPowerData.customEnums[typeof(Brand)].IndexOf(name))
            {
                if (BGSprite != null)
                {
                    S.I.deCtrl.spellBackgroundBrands.Add(LuaPowerSprites.GetSprite(BGSprite));
                }
                else
                {
                    S.I.deCtrl.spellBackgroundBrands.Add(LuaPowerSprites.GetSprite(sprite));
                }
            }
        }
        else if (BGSprite != null && LuaPowerSprites.GetSprite(BGSprite) != null)
        {
            S.I.deCtrl.spellBackgroundBrands[LuaPowerData.customEnums[typeof(Brand)].IndexOf(name)] = LuaPowerSprites.GetSprite(BGSprite);
        }
        else
        {
            S.I.deCtrl.spellBackgroundBrands[LuaPowerData.customEnums[typeof(Brand)].IndexOf(name)] = LuaPowerSprites.GetSprite(sprite);
        }
        foreach (BrandListCard b in S.I.foCtrl.brandListCards)
        {
            if (b.brand == (Brand)LuaPowerData.customEnums[typeof(Brand)].IndexOf(name))
            {
                b.image.sprite = LuaPowerSprites.GetSprite(sprite);
            }
        }
    }
 public static void SetBrandImage(string name, string sprite, string BGSprite = null)
 {
     if (!LuaPowerData.customEnums[typeof(Brand)].Contains(name))
     {
         Debug.Log("ERROR: A Brand does not exist with that name.\nYou should run MakeBrand first.");
         return;
     }
     Array.Resize(ref S.I.deCtrl.brandSprites, Mathf.Max(S.I.deCtrl.brandSprites.Length, LuaPowerData.customEnums[typeof(Brand)].IndexOf(name) + 1));
     S.I.deCtrl.brandSprites[LuaPowerData.customEnums[typeof(Brand)].IndexOf(name)] = LuaPowerSprites.GetSprite(sprite);
     if (S.I.deCtrl.spellBackgroundBrands.Count <= LuaPowerData.customEnums[typeof(Brand)].IndexOf(name))
     {
         while (S.I.deCtrl.spellBackgroundBrands.Count <= LuaPowerData.customEnums[typeof(Brand)].IndexOf(name))
         {
             if (BGSprite != null)
             {
                 S.I.deCtrl.spellBackgroundBrands.Add(LuaPowerSprites.GetSprite(BGSprite));
             }
             else
             {
                 S.I.deCtrl.spellBackgroundBrands.Add(LuaPowerSprites.GetSprite(sprite));
             }
         }
     }
     else if (BGSprite != null && LuaPowerSprites.GetSprite(BGSprite) != null)
     {
         S.I.deCtrl.spellBackgroundBrands[LuaPowerData.customEnums[typeof(Brand)].IndexOf(name)] = LuaPowerSprites.GetSprite(BGSprite);
     }
     else
     {
         S.I.deCtrl.spellBackgroundBrands[LuaPowerData.customEnums[typeof(Brand)].IndexOf(name)] = LuaPowerSprites.GetSprite(sprite);
     }
     foreach (BrandListCard b in S.I.foCtrl.brandListCards)
     {
         if (b.brand == (Brand)LuaPowerData.customEnums[typeof(Brand)].IndexOf(name))
         {
             b.image.sprite = LuaPowerSprites.GetSprite(sprite);
         }
     }
 }