Beispiel #1
0
    public PeforManceDatas()
    {
        Peformances = new Dictionary <PeforManceType, List <PeforManceDataBase> >();
        Peformances[PeforManceType.Money] = new List <PeforManceDataBase>();
        Peformances[PeforManceType.Plant] = new List <PeforManceDataBase>();
        Peformances[PeforManceType.Time]  = new List <PeforManceDataBase>();
        PeforManceDataBase[] d   = Resources.LoadAll <PeforManceDataBase>("PeforMance/Money");
        PeforManceType       key = PeforManceType.Money;

        for (int j = 0; j < 3; j++)
        {
            switch (j)
            {
            case 1:
                d   = Resources.LoadAll <PeforManceDataBase>("PeforMance/Plant");
                key = PeforManceType.Plant;
                break;

            case 2:
                d   = Resources.LoadAll <PeforManceDataBase>("PeforMance/Time");
                key = PeforManceType.Time;
                break;

            default:
                break;
            }
            for (int i = 0; i < d.Length; i++)
            {
                Peformances[key].Add(d[i]);
                Peformances[key][i].NowState  = 0;
                Peformances[key][i].Clear     = false;
                Peformances[key][i].rewardGet = false;
            }
        }
    }
Beispiel #2
0
    public void DataSet(PeforManceSaveDatas d)
    {
        PeforManceType            key  = PeforManceType.Money;
        List <PeforManceSaveData> data = d.Money;

        for (int j = 0; j < 3; j++)
        {
            switch (j)
            {
            case 1:
                key  = PeforManceType.Plant;
                data = d.Plant;
                break;

            case 2:
                key  = PeforManceType.Time;
                data = d.Time;
                break;

            default:
                break;
            }
            for (int i = 0; i < Peformances[key].Count; i++)
            {
                Peformances[key][i].SaveDataSet(data[i]);
            }
        }
    }
Beispiel #3
0
 public void DataUnlock(PeforManceType type, long value)
 {
     foreach (PeforManceDataBase data in Peformances[type])
     {
         data.NowState += value;
         data.GetIsUnlock();
     }
 }
Beispiel #4
0
    public PeforManceSaveDatas(PeforManceDatas d)
    {
        Money = new List <PeforManceSaveData>();
        Plant = new List <PeforManceSaveData>();
        Time  = new List <PeforManceSaveData>();
        PeforManceType key = PeforManceType.Money;

        for (int j = 0; j < 3; j++)
        {
            switch (j)
            {
            case 1:
                key = PeforManceType.Plant;
                break;

            case 2:
                key = PeforManceType.Time;
                break;

            default:
                break;
            }
            for (int i = 0; i < d.Peformances[key].Count; i++)
            {
                switch (j)
                {
                case 0:
                    Money.Add(new PeforManceSaveData(d.Peformances[key][i]));
                    break;

                case 1:
                    Plant.Add(new PeforManceSaveData(d.Peformances[key][i]));
                    break;

                case 2:
                    Time.Add(new PeforManceSaveData(d.Peformances[key][i]));
                    break;
                }
            }
        }
    }
    public PeforManceManager(MenuManager m) : base(m)
    {
        myObjct           = GameObject.Find("Menu").transform.Find("Peformance").gameObject;
        ItemButtons       = new List <Button>();
        PeformanceButtons = new List <Button>();
        datas             = PlayerData.GetInstance().PD;
        peforManceButton  = Resources.Load <GameObject>("Prefabs/PefoeManceButton");
        listParent        = myObjct.transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0).gameObject;
        PeforManceType key     = PeforManceType.Money;
        int            backNum = 0;

        for (int j = 0; j < 3; j++)
        {
            switch (j)
            {
            case 1:
                key = PeforManceType.Plant;
                break;

            case 2:
                key = PeforManceType.Time;
                break;

            default:
                break;
            }
            for (int i = 0; i < datas.Peformances[key].Count; i++)
            {
                PeformanceButtons.Add(GameObject.Instantiate(peforManceButton, listParent.transform).GetComponent <Button>());
                PeformanceButtons[backNum + i].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = datas.Peformances[key][i].Title;
                PeformanceButtons[backNum + i].gameObject.SetActive(false);
            }
            backNum += datas.Peformances[key].Count;
        }
        myObjct.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(() => StateChange(PeforManceMenuState.PeforMance));
        myObjct.transform.GetChild(2).GetComponent <Button>().onClick.AddListener(() => StateChange(PeforManceMenuState.Library));
        ItemPref = Resources.Load <Button>("Prefabs/PeItemButton");
    }
    void MenuSet()
    {
        var buttons = (state == PeforManceMenuState.PeforMance ? PeformanceButtons:ItemButtons);
        int count   = 0;

        ParagraphSet();
        foreach (Button b in PeformanceButtons)
        {
            b.gameObject.SetActive(false);
        }
        foreach (Button b in ItemButtons)
        {
            b.gameObject.SetActive(false);
        }
        if (state == PeforManceMenuState.PeforMance)
        {
            myObjct.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = "実績";
            PeforManceType key = PeforManceType.Money;
            for (int j = 0; j < 3; j++)
            {
                switch (j)
                {
                case 1:
                    key = PeforManceType.Plant;
                    break;

                case 2:
                    key = PeforManceType.Time;
                    break;

                default:
                    break;
                }
                for (int i = 0; i < datas.Peformances[key].Count; i++)
                {
                    buttons[count].gameObject.SetActive(true);
                    buttons[count].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = datas.Peformances[key][i].Title;
                    buttons[count].transform.GetChild(1).GetComponent <Slider>().maxValue      = datas.Peformances[key][i].conditions;
                    buttons[count].transform.GetChild(1).GetComponent <Slider>().minValue      = 0;
                    buttons[count].transform.GetChild(1).GetComponent <Slider>().value         = datas.Peformances[key][i].NowState;
                    buttons[count].transform.GetChild(2).GetComponent <TextMeshProUGUI>().text = datas.Peformances[key][i].NowState + "/\n" + datas.Peformances[key][i].conditions;
                    PeforManceDataBase d = datas.Peformances[key][i];
                    buttons[count].onClick.RemoveAllListeners();
                    buttons[count++].onClick.AddListener(() => ParagraphSet(d));
                }
            }
            ParagraphSet();
        }
        else
        {
            myObjct.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = "図鑑";
            foreach (Item i in PlayerData.GetInstance().DicList.Item)
            {
                if (count >= buttons.Count)
                {
                    buttons.Add(GameObject.Instantiate(ItemPref, listParent.transform));
                }
                buttons[count].gameObject.SetActive(true);
                buttons[count].transform.GetChild(0).GetComponent <TextMeshProUGUI>().text = i.itemName;
                buttons[count].transform.GetChild(1).GetComponent <Image>().sprite         = i.icon;
                Item it = PlayerData.GetInstance().DicList.Item[count];
                buttons[count].onClick.RemoveAllListeners();
                buttons[count++].onClick.AddListener(() => ParagraphSet(it));
            }
        }
    }