Exemplo n.º 1
0
    private void ManageItemDropResultForJsonToValue(string json, BattleStateData battleStateData)
    {
        string[] array             = JsonReader.Deserialize(json, typeof(string[])) as string[];
        List <ItemDropResult> list = new List <ItemDropResult>();

        foreach (string value in array)
        {
            ItemDropResultStore itemDropResultStore = JsonReader.Deserialize(value, typeof(ItemDropResultStore)) as ItemDropResultStore;
            ItemDropResult      item = new ItemDropResult(itemDropResultStore.dropBoxType);
            list.Add(item);
        }
        battleStateData.itemDropResults = list;
    }
Exemplo n.º 2
0
    public void DisplayItemDrops(List <ItemData> itemDrops)
    {
        // Create an Item Drop Result gameObject for each dropped item
        float spacing = 330f;

        for (int i = 0; i < itemDrops.Count; i++)
        {
            // Position equidistant for now - think of something fun later TODO
            GameObject resultPreview = Instantiate(this.ItemDropResultPrefab);
            resultPreview.transform.SetParent(this.FirstItemDropPosition);
            resultPreview.transform.localPosition = new Vector3(i * spacing, 0);

            // Set name label
            ItemDropResult itemDropResult = resultPreview.GetComponent <ItemDropResult>();
            itemDropResult.SetImageName(itemDrops[i].name);
        }
    }
 public ItemDropResultData(ItemDropResult _itemDropResult, int _effectIndex)
 {
     this.itemDropResult = _itemDropResult;
     this.effectIndex    = _effectIndex;
 }