Exemplo n.º 1
0
    public void SetData(ItemInventory ii, UITattoo caller)
    {
        _itemInventory = ii;

        if (ii != null)
        {
            icon.gameObject.SetActive(true);

            icon.mainTexture = InJoy.AssetBundles.AssetBundles.Load(ii.ItemData.iconPath) as Texture2D;

            _isLocked = false;
        }
        else
        {
            icon.gameObject.SetActive(false);

            int playerLevel = PlayerInfo.Instance.CurrentLevel;

            TattooUnlockDataList tudList = DataManager.Instance.tattooUnlockDataList;

            if (tudList.IsLocked(this.part, playerLevel, out _unlockLevel))
            {
                _isLocked = true;
            }
            else
            {
                _isLocked = false;
            }
        }
        spriteLock.SetActive(_isLocked);

        _uiTattoo = caller;
    }
Exemplo n.º 2
0
    public static void Read()
    {
        bool newFile = false;

        TattooUnlockDataList dataList = null;

        UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outFileName, typeof(TattooUnlockDataList));
        if (oldFile == null)
        {
            newFile  = true;
            dataList = ScriptableObject.CreateInstance(typeof(TattooUnlockDataList)) as TattooUnlockDataList;
        }
        else
        {
            dataList = oldFile as TattooUnlockDataList;
        }

        dataList.dataList.Clear();

        string jsonStr = File.ReadAllText(fileName);

        JsonHashtable ht = FCJson.jsonDecode(jsonStr) as JsonHashtable;

        foreach (System.Object obj in ht.ValueList)
        {
            Hashtable ht2 = obj as Hashtable;

            TattooUnlockData newData = new TattooUnlockData();

            newData.part        = (EnumTattooPart)(int)ht2["tattooPart"];
            newData.playerLevel = (int)ht2["unlockLevel"];

            dataList.dataList.Add(newData);
        }

        if (newFile)
        {
            AssetDatabase.CreateAsset(dataList, outFileName);
        }
        else
        {
            EditorUtility.SetDirty(dataList);
        }

        dataList.dataList.Sort(new MyComparer());

        Debug.Log(string.Format("Tattoo unlock data imported OK. {0} records.", dataList.dataList.Count));
    }