コード例 #1
0
    public void LoadallData()
    {
        playerDataInfo  = Utility.ReadDataFromJSON <ListDataInfo>(Constants.JSONIndex.DATA_PLAYER);
        enemiesDataInfo = Utility.ReadDataFromJSON <ListEnemiesInfo>(Constants.JSONIndex.DATA_ENEMY);
        itemDataInfo    = Utility.ReadDataFromJSON <ListItemsInfo>(Constants.JSONIndex.DATA_ITEM);
        envData         = Utility.ReadDataFromJSON <EnvironmentData>(Constants.JSONIndex.DATA_ENVIRONMENT);
        workData        = Utility.ReadDataFromJSON <ListWorkInfo>(Constants.JSONIndex.DATA_WORK);
        config          = Utility.ReadDataFromJSON <Configuration>(Constants.JSONIndex.DATA_CONFIG);
        creditData      = Utility.ReadDataFromJSON <ListCreditInfo>(Constants.JSONIndex.DATA_CREDIT);

        Debug.Log("All Data Loaded");
        //Debug.Log(enemiesStatus[0].statsList[0].Agility);
    }
コード例 #2
0
ファイル: WorkPanel.cs プロジェクト: Manaflare/TheGladiator
    public void ResetWork()
    {
        if (workProgress == WorkProgress.Is_Working)
        {
            bReservedResetWork = true;
            return;
        }

        if (playerData == null)
        {
            playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        }
        //clear list
        workList.Clear();
        playerData.workIndexList.Clear();

        ListWorkInfo allWorkInfo = MasterManager.ManagerGlobalData.GetAllWorkData();

        int listSize = allWorkInfo.workList.Count;

        int[] randomIndecies = new int[listSize];
        for (int i = 0; i < listSize; ++i)
        {
            randomIndecies[i] = i;
        }

        //random pick
        int temp, randomIndex, actualIndex;

        for (int i = 0; i < availiableWorkNum; ++i)
        {
            randomIndex = Random.Range(0, listSize);
            actualIndex = randomIndecies[randomIndex];

            workList.Add(allWorkInfo.workList[actualIndex]);
            playerData.workIndexList.Add(actualIndex);

            //move the element to the end the list
            temp = randomIndecies[randomIndex];
            randomIndecies[randomIndex]  = randomIndecies[listSize - 1];
            randomIndecies[listSize - 1] = temp;

            listSize--;
        }

        //current work page setup
        SetCurrentWork();
    }
コード例 #3
0
ファイル: WorkPanel.cs プロジェクト: Manaflare/TheGladiator
    void Awake()
    {
        playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();

        //only at once
        if (TownManager.Instance.IsitFirstPlay())
        {
            ResetWork();
        }
        else
        {
            ListWorkInfo allWorkInfo = MasterManager.ManagerGlobalData.GetAllWorkData();
            for (int i = 0; i < playerData.workIndexList.Count; ++i)
            {
                int actualIndex = playerData.workIndexList[i];
                workList.Add(allWorkInfo.workList[actualIndex]);
            }

            //only if there is still work availiable in the work list
            if (workList.Count > 0)
            {
                SetCurrentWork();
            }
            else
            {
                Current.GetComponentInChildren <WorkWindow>().SetWorkWindow("", "", "");
                goldText.text    = "";
                staminaText.text = "";
                TimeText.text    = "";
            }
        }

        bMoving            = false;
        bReservedResetWork = false;
        workProgress       = WorkProgress.Is_Ready;
    }