Esempio n. 1
0
        public ChartsMetricsModel(List <HalbotActivity> activities)
        {
            //initialize data
            Activities = activities;

            // create chart
            var data = new DataSet("activities")
            {
                Items = activities.Select(a => new DataItem {
                    Value = a.Effort, Date = a.Date
                }).ToList()
            };

            SpiderChart = new SpiderChart("Metrics", 900, 10, data);
        }
    // Start is called before the first frame update
    void Awake()
    {
        if (inventoryScreen)
        {
            unitSpotlight = GameObject.FindGameObjectWithTag("UnitSpotlight").transform;
            statShower    = GameObject.FindGameObjectWithTag("UnitStats").transform;
            eventSystem   = FindObjectOfType <EventSystem>();
            gRayCaster    = FindObjectOfType <GraphicRaycaster>();
            spiderMate    = FindObjectOfType <SpiderChart>();
            GameObject statBreakdown = statShower.GetChild(3).gameObject;
            statsBreakdown = statBreakdown.GetComponentsInChildren <TextMeshProUGUI>();
        }

        inventoryBoard      = GameObject.FindGameObjectWithTag("InventoryBoard").transform;
        inventoryCardPlacer = inventoryBoard.GetChild(1);

        if (debugPopulate)
        {
            DebugPopulate(debugInventorySize);
        }
        else
        {
            if (!System.IO.File.Exists(Application.persistentDataPath + "/saveFile.json"))
            {
                InventoryData dat      = new InventoryData();
                string        jsonData = JsonUtility.ToJson(dat);
                File.WriteAllText(Application.persistentDataPath + "/saveFile.json", jsonData);
            }
            string json     = File.ReadAllText(Application.persistentDataPath + "/saveFile.json");
            int[]  loadData = JsonUtility.FromJson <InventoryData>(json).data;
            for (int i = 0; i < possibleCharacters.Length; i++)
            {
                if (loadData[i] > 0)
                {
                    for (int j = 0; j < loadData[i]; j++)
                    {
                        inventory.Add(possibleCharacters[i]);
                    }
                }
            }
        }

        CreateInventoryCards();
    }