Пример #1
0
 public static void GenerateCustomIcons()
 {
     if (MenuShop.generated)
     {
         return;
     }
     MenuShop.generated = true;
     for (int i = 512; i < 1024; i++)
     {
         if (MenuShop.shopdata[i] != null)
         {
             string[] array = MenuShop.shopdata[i].iconname.Split(new char[]
             {
                 '_'
             });
             if (array.Length == 3)
             {
                 GameObject gameObject = ItemPreview.Create("w_" + array[0]);
                 if (gameObject == null)
                 {
                     MonoBehaviour.print("error create preview: w_" + array[0]);
                 }
                 else
                 {
                     ItemPreview.SetSkin(gameObject, MenuShop.shopdata[i].iconname);
                     MenuShop.shopdata[i].icon = ItemPreview.Get();
                     UnityEngine.Object.DestroyImmediate(gameObject);
                 }
             }
         }
     }
 }
Пример #2
0
    public static void Preview(MenuShop.CShopData item)
    {
        if (MenuPreview.go != null)
        {
            MenuPreview.go.name = string.Concat(new object[]
            {
                "item_",
                Time.time,
                " ",
                UnityEngine.Random.Range(0, 1000)
            });
            UnityEngine.Object.Destroy(MenuPreview.go);
        }
        MenuPreview.currData = item;
        if (MenuPreview.currData == null)
        {
            return;
        }
        string[] array = MenuPreview.currData.iconname.Split(new char[]
        {
            '_'
        });
        if (array.Length != 3)
        {
            return;
        }
        MenuPreview.go = ItemPreview.Create("w_" + array[0]);
        if (MenuPreview.go == null)
        {
            MonoBehaviour.print("error create preview w_" + array[0]);
            return;
        }
        ItemPreview.SetSkin(MenuPreview.go, MenuPreview.currData.iconname);
        Transform[] componentsInChildren = MenuPreview.go.GetComponentsInChildren <Transform>();
        Transform[] array2 = componentsInChildren;
        for (int i = 0; i < array2.Length; i++)
        {
            Transform transform = array2[i];
            transform.gameObject.layer = 0;
        }
        RotateModel rotateModel = MenuPreview.go.AddComponent <RotateModel>();

        rotateModel.fullrotate = true;
    }