// Use this for initialization
    protected virtual void  Start()
    {
        higherColor    = new Color(0, .5f, 0);
        lowerColor     = new Color(1, 0, 0);
        activeColor    = new Color(1, 1, 1);
        desactiveColor = new Color(.8f, .8f, .8f);
        equalsColor    = new Color(0, 0, 0);
        hiddenColor    = new Color(0, 0, 0, 0);

        Armors     = MasterManager.ManagerSprite.ArmorList;
        Helmets    = MasterManager.ManagerSprite.HelmetList;
        LeftHands  = MasterManager.ManagerSprite.LeftHandList;
        RightHands = MasterManager.ManagerSprite.RightHandList;
        Pants      = MasterManager.ManagerSprite.PantsList;
        Shoes      = MasterManager.ManagerSprite.ShoesList;

        equipedItems     = new List <ItemDataInfo>();
        playerData       = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        filteredItemList = itemList = playerData.itemList;

        for (int i = 0; i < playerData.equipedItensId.Count; i++)
        {
            for (int p = 0; p < itemList.Count; p++)
            {
                if (itemList[p].id == playerData.equipedItensId[i])
                {
                    equipedItems.Add(itemList[p]);
                }
            }
        }
        UpdateItemArea();
        UpdateEquipedVisual();
    }
Exemple #2
0
    public ListDataInfo(ListDataInfo ldf)
    {
        statsList      = new List <Stats>();
        spriteList     = new List <SpriteInfo>();
        itemList       = new List <ItemDataInfo>();
        equipedItensId = new List <int>();
        workIndexList  = new List <int>();

        playerTier = ldf.playerTier;
        foreach (var a in ldf.equipedItensId)
        {
            equipedItensId.Add(a);
        }
        foreach (var a in ldf.itemList)
        {
            itemList.Add(a);
        }
        foreach (var a in ldf.spriteList)
        {
            spriteList.Add(a);
        }
        foreach (var a in ldf.statsList)
        {
            statsList.Add(a);
        }
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        ListDataInfo playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();

        //buttons are only usable if your tier is high enough; better healing options require you to be higher tier
        if (playerData.playerTier == 1)
        {
            buttonLow.GetComponent <Button>().interactable  = true;
            buttonMid.GetComponent <Button>().interactable  = false;
            buttonHigh.GetComponent <Button>().interactable = false;
        }
        else if (playerData.playerTier == 2)
        {
            buttonLow.GetComponent <Button>().interactable  = true;
            buttonMid.GetComponent <Button>().interactable  = true;
            buttonHigh.GetComponent <Button>().interactable = false;
        }
        else if (playerData.playerTier == 3)
        {
            buttonLow.GetComponent <Button>().interactable  = true;
            buttonMid.GetComponent <Button>().interactable  = true;
            buttonHigh.GetComponent <Button>().interactable = true;
        }

        Button btn = leaveButton.GetComponent <Button>();

        btn.onClick.AddListener(DestroyOnClick);
    }
    void Start()
    {
        PlayerPrefs.SetInt("Ending", 0);

        // call BGM
        MasterManager.ManagerSound.PlayBackgroundMusic(backgroundMusic);

        playerStatusList = new ListDataInfo();
        Reset();
    }
    // Use this for initialization
    void Start()
    {
        Button btn = continueButton.GetComponent <Button>();

        btn.onClick.AddListener(closeOnClick);

        ListDataInfo playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();

        currentTier.text = playerData.playerTier.ToString();
    }
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        currentTier    = playerDataInfo.playerTier == 0 ? 1 : playerDataInfo.playerTier;

        enemyDataInfo = MasterManager.ManagerGlobalData.GetEnemyDataInfo();
        enemyData     = new List <ListDataInfo>();

        //Button btn = test.GetComponent<Button>();
        //btn.onClick.AddListener(findRandomEnemyData);
        findRandomEnemyData();
    }
    void TrainingCost()
    {
        ListDataInfo playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();

        playerDataInfo.statsList[0].Stamina -= (short)(CostStamina);
        //NewStam.text = playerDataInfo.statsList[0].Stamina.ToString();

        EnvironmentData envData = MasterManager.ManagerGlobalData.GetEnvData();

        envData.gold -= CostGold;
        //NewGold.text = envData.gold.ToString("N0");
    }
Exemple #8
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);
    }
Exemple #9
0
    public void NewPage()
    {
        ListDataInfo newEnemy       = new ListDataInfo();
        Stats        newEnemyStat   = new Stats("New Enemy", Constants.PlayerType.ENEMY, 0, 0, 0, 0, 0);
        SpriteInfo   newEnemySprite = new SpriteInfo(0, 0, 0);

        newEnemy.statsList.Add(newEnemyStat);
        newEnemy.spriteList.Add(newEnemySprite);
        enemyList.enemyData.Add(newEnemy);
        newEnemy.playerTier = 1;
        Start();
        enemyDropDown.value = enemyDropDown.options.Count - 1;
    }
Exemple #10
0
    public override void StartGame()
    {
        if (this.avaliablePoints < 0 || this.avaliablePoints > 0)
        {
            Debug.LogWarning("You spend more of skills it is avaliable, please rebalance it");
            return;
        }
        Stats        playerStats      = new Stats(NameText.text, Constants.PlayerType.ENEMY, HPPoints, StrPoints, AgiPoints, DexPoints, StaPoints);
        SpriteInfo   playerSpriteInfo = new SpriteInfo(faceHairIndex, hairIndex, bodyIndex);
        ListDataInfo enemy            = new ListDataInfo(playerStats, playerSpriteInfo);

        enemy.playerTier = tier;
        enemyList.enemyData[enemyDropDown.value] = enemy;
        MasterManager.ManagerGlobalData.SetEnemyDataInfo(enemyList, true);
    }
    // Use this for initialization
    protected virtual void Start()
    {
        if (MasterManager.ManagerGlobalData == null)
        {
            return;
        }
        foreach (Transform child in this.gameObject.transform)
        {
            GameObject.Destroy(child.gameObject);
        }
        loadImages();

        playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        applySettings();
    }
Exemple #12
0
    private void SetCurrentWork()
    {
        if (workList.Count > 0)
        {
            if (playerData == null)
            {
                playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
            }

            SetWorkPage(workList[currentIndex], Current);
            goldText.text    = (workList[currentIndex].gold * playerData.playerTier).ToString("N0");
            staminaText.text = (workList[currentIndex].stamina * playerData.playerTier).ToString();// + "  [" + MasterManager.ManagerGlobalData.GetPlayerDataInfo().GetActualStats().Stamina.ToString() + "]";
            TimeText.text    = ((int)(workList[currentIndex].turn * Constants.HOUR_SPENT)).ToString();
        }
    }
Exemple #13
0
    public void LoadEnemy()
    {
        ListDataInfo selectedEnemy = new ListDataInfo();

        for (int i = 0; i < enemyList.enemyData.Count; i++)
        {
            string enemyName = enemyDropDown.options[enemyDropDown.value].text;
            if (enemyList.enemyData[i].statsList[0].Name == enemyName)
            {
                selectedEnemy = enemyList.enemyData[i];
                break;
            }
        }
        Populate(selectedEnemy);
    }
Exemple #14
0
    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();
    }
    // Use this for initialization
    void Start()
    {
        rngCannon = Random.Range(0, 100);

        Button btn = continueButton.GetComponent <Button>();

        btn.onClick.AddListener(continueButtonClick);

        playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        currentTier    = playerDataInfo.playerTier == 0 ? 1 : playerDataInfo.playerTier;

        itemDataInfo = MasterManager.ManagerGlobalData.GetItemDataInfo();
        itemData     = new List <ItemDataInfo>();

        fireTheCannon();
    }
Exemple #16
0
    public void CallBackEndSleep()
    {
        // sleepImage.SetActive(false);
        ListDataInfo    playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        EnvironmentData envData        = MasterManager.ManagerGlobalData.GetEnvData();

        Constants.HouseType houseType = (Constants.HouseType)envData.house_level;
        float multiPlier = 100.0f;

        //Generates stamina;
        //to do : depends on house level

        /*
         *  level 1 - 45%;
         *  level 2 - 65%;
         *  level 3 - 85%;
         *  level 4 - 110%;
         */
        switch (houseType)
        {
        case Constants.HouseType.SMALL:
            multiPlier = 0.45f;
            break;

        case Constants.HouseType.MEDIUM:
            multiPlier = 0.65f;
            break;

        case Constants.HouseType.HUGE:
            multiPlier = 0.85f;
            break;

        case Constants.HouseType.MANSION:
            multiPlier = 1.00f;
            break;

        default:
            break;
        }
        short addAmount = (short)(playerDataInfo.GetActualStats().MaxStamina *multiPlier);

        playerDataInfo.statsList[0].Stamina = (short)Mathf.Min((int)playerDataInfo.statsList[0].MaxStamina, (int)playerDataInfo.statsList[0].Stamina + addAmount);
        //Refills HP to 100 %;
        playerDataInfo.statsList[0].HP = (int)(playerDataInfo.GetActualStats().MAXHP *Constants.HP_MULTIPLIER);
        MasterManager.ManagerGlobalData.SavePlayerData();
        TownManager.Instance.UpdatePlayerUI();
    }
    private void TrainStat(Text originText, Text newText, int multiplier = 1)
    {
        //for variables in train complete window

        int oldStat = int.Parse(originText.text);
        int newStat = oldStat + ((Random.Range(1, 4) * multiplier));



        newText.text = newStat.ToString();
        ListDataInfo playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();

        playerDataInfo.statsList[0].Agility    = byte.Parse(NewAgility.text);
        playerDataInfo.statsList[0].Dexterity  = byte.Parse(NewDexterity.text);
        playerDataInfo.statsList[0].MaxStamina = short.Parse(NewMaxStam.text);
        playerDataInfo.statsList[0].Strength   = byte.Parse(NewStr.text);
        playerDataInfo.statsList[0].MAXHP      = int.Parse(NewMaxHP.text) / HpMultiplier;


        MasterManager.ManagerGlobalData.SavePlayerData();
    }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        // call BGM and SFX
        MasterManager.ManagerSound.PlayBackgroundMusic(backgroundMusic);
        MasterManager.ManagerSound.PlaySingleSound("Sword Clash");

        Button ngb = newGameButton.GetComponent <Button>();

        ngb.onClick.AddListener(toCharacterCreation);

        Button lgb = continueButton.GetComponent <Button>();

        lgb.onClick.AddListener(continueFile);

        Button setb = settingsButton.GetComponent <Button>();

        setb.onClick.AddListener(loadSettingsMenu);

        Button creditb = creditButton.GetComponent <Button>();

        creditb.onClick.AddListener(loadCredit);

        playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        if (playerData.spriteList.Count == 0)
        {
            lgb.interactable = false;
            dataBlock.SetActive(false);
        }
        else
        {
            Stats actualStat = playerData.GetActualStats();

            playerName.text = actualStat.Name;
            HP.text         = (actualStat.MAXHP * Constants.HP_MULTIPLIER).ToString();
            STR.text        = actualStat.Strength.ToString();
            AGI.text        = actualStat.Agility.ToString();
            DEX.text        = actualStat.Dexterity.ToString();
            STA.text        = actualStat.MaxStamina.ToString();
        }
    }
    bool canTrain()
    {
        bool         Result         = true;
        ListDataInfo playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();

        if (playerDataInfo.GetActualStats().Stamina < CostStamina)
        {
            MasterManager.ManagerPopup.ShowMessageBox("System", "You don't have enough Stamina!", Constants.PopupType.POPUP_SYSTEM);
            Result = false;
        }
        else
        {
            EnvironmentData envData = MasterManager.ManagerGlobalData.GetEnvData();
            if (envData.gold < CostGold)
            {
                MasterManager.ManagerPopup.ShowMessageBox("System", "You don't have enough Gold!", Constants.PopupType.POPUP_SYSTEM);
                Result = false;
            }
        }

        return(Result);
    }
Exemple #20
0
    public void UpdatePlayerUI()
    {
        ListDataInfo playerData = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        Stats        actStat    = playerData.GetActualStats();

        playerName.text = playerData.statsList[0].Name;
        MaxHP.text      = (actStat.MAXHP * Constants.HP_MULTIPLIER).ToString();
        // HP.text = actStat.HP.ToString();
        STR.text = actStat.Strength.ToString();
        AGI.text = actStat.Agility.ToString();
        DEX.text = actStat.Dexterity.ToString();
        // STA.text = actStat.Stamina.ToString();
        MaxSTA.text = actStat.MaxStamina.ToString();
        Tier.text   = playerData.playerTier.ToString();
        Character.GetComponent <CharacterSpriteManager>().UpdateSprites();

        if (actStat.HP > actStat.MAXHP)
        {
            actStat.HP = (int)(actStat.MAXHP * Constants.HP_MULTIPLIER);
            playerData.statsList[0].HP = actStat.HP;
            MasterManager.ManagerGlobalData.SavePlayerData();
        }

        barMaxHP.text  = MaxHP.text;
        barCurHP.text  = actStat.HP.ToString();
        HPBar.maxValue = actStat.MAXHP;
        HPBar.minValue = 1;
        HPBar.value    = actStat.HP;

        barMaxSTA.text      = MaxSTA.text;
        barCurSTA.text      = actStat.Stamina.ToString();
        StaminaBar.maxValue = actStat.MaxStamina;
        StaminaBar.minValue = 1;
        StaminaBar.value    = actStat.Stamina;


        UpdateEnvUI();
    }
Exemple #21
0
    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;
    }
Exemple #22
0
    void Populate(ListDataInfo playerData)
    {
        this.NameText.text = playerData.statsList[0].Name;
        this.bodyIndex     = playerData.spriteList[0].BodyIndex;
        this.faceHairIndex = playerData.spriteList[0].FaceHairIndex;
        this.hairIndex     = playerData.spriteList[0].HairIndex;

        BodyArrowPressed("NONE");
        HairArrowPressed("NONE");
        FaceHairArrowPressed("NONE");

        this.HPPoints  = playerData.statsList[0].MAXHP;
        this.StrPoints = playerData.statsList[0].Strength;
        this.AgiPoints = playerData.statsList[0].Agility;
        this.DexPoints = playerData.statsList[0].Dexterity;
        this.StaPoints = playerData.statsList[0].Stamina;

        this.tier = playerData.playerTier;
        this.startinAvaliablePoints = (this.BaseStats * skillPointsPerTier) * tier;
        int spentPoints = this.HPPoints + this.StrPoints + this.AgiPoints + this.DexPoints + this.StaPoints;

        this.avaliablePoints = startinAvaliablePoints + (BaseStats * 5) - spentPoints;
        UpdateStatusText();
    }
 public void Draw(ListDataInfo draw)
 {
     loadImages();
     playerData = new ListDataInfo(draw);
     applySettings();
 }
    // Use this for initialization
    void OnEnable()
    {
        ListDataInfo playerDataInfo = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        int          agil           = playerDataInfo.statsList[0].Agility;

        text_agil.text = NewAgility.text = agil.ToString();

        if (agil == byte.MaxValue)
        {
            Agi_btn.gameObject.SetActive(false);
        }
        else
        {
            Agi_btn.enabled = true;
        }

        int Maxstam = playerDataInfo.statsList[0].MaxStamina;

        text_MaxStam.text = NewMaxStam.text = Maxstam.ToString();
        if (Maxstam == byte.MaxValue)
        {
            Sta_btn.gameObject.SetActive(false);
        }
        else
        {
            Sta_btn.enabled = true;
        }

        int str = playerDataInfo.statsList[0].Strength;

        text_str.text = NewStr.text = str.ToString();
        if (str == byte.MaxValue)
        {
            Str_btn.gameObject.SetActive(false);
        }
        else
        {
            Str_btn.enabled = true;
        }


        int dex = playerDataInfo.statsList[0].Dexterity;

        text_dex.text = NewDexterity.text = dex.ToString();
        if (dex == byte.MaxValue)
        {
            Dex_btn.gameObject.SetActive(false);
        }
        else
        {
            Dex_btn.enabled = true;
        }


        int MaxHp = playerDataInfo.statsList[0].MAXHP * HpMultiplier;

        text_MaxHp.text = NewMaxHP.text = MaxHp.ToString();
        if (MaxHp == byte.MaxValue)
        {
            MHp_btn.gameObject.SetActive(false);
        }
        else
        {
            MHp_btn.enabled = true;
        }

        int totalPoints = playerDataInfo.statsList[0].MAXHP + playerDataInfo.statsList[0].Strength + playerDataInfo.statsList[0].Agility + playerDataInfo.statsList[0].Dexterity + playerDataInfo.statsList[0].MaxStamina;

        CostStamina = Mathf.RoundToInt(playerDataInfo.GetActualStats().MaxStamina * 0.3f);

        CostGold             = Mathf.RoundToInt((totalPoints / CostBase) * CostGoldBase);
        CostStaminaText.text = CostStamina.ToString();
        CostGoldText.text    = CostGold.ToString();


        TrainingCompletionPrefab.SetActive(false);
        //Stats playerStats = new Stats(NameText.text, Constants.PlayerType.PLAYER, HPPoints, StrPoints, AgiPoints, DexPoints, StaPoints);
        //SpriteInfo playerSpriteInfo = new SpriteInfo(faceHairIndex, hairIndex, bodyIndex);
        //MasterManager.ManagerGlobalData.SetPlayerDataInfo(playerStats, playerSpriteInfo, true);
    }
Exemple #25
0
 public void NewGame()
 {
     config         = new Configuration();
     envData        = new EnvironmentData();
     playerDataInfo = new ListDataInfo();
 }
    void fireTheCannon()
    {
        if (rngCannon < 50)
        {
            itemTier = currentTier == 1 ? currentTier : currentTier - 1;
        }
        else if (rngCannon > 50 && rngCannon < 85)
        {
            itemTier = currentTier;
        }
        else
        {
            itemTier = currentTier + 1;
        }

        for (int i = 0; i < itemDataInfo.itemData.Count; i++)
        {
            if (itemDataInfo.itemData[i].Tier == itemTier)
            {
                itemData.Add(itemDataInfo.itemData[i]);
            }
        }

        int itemID = Random.Range(0, itemData.Count - 1);

        itemName.text = itemData[itemID].Stats.Name.ToString();
        itemHP.text   = itemData[itemID].Stats.HP.ToString();
        itemSTR.text  = itemData[itemID].Stats.Strength.ToString();
        itemAGI.text  = itemData[itemID].Stats.Agility.ToString();
        itemDEX.text  = itemData[itemID].Stats.Dexterity.ToString();
        itemSTA.text  = itemData[itemID].Stats.Stamina.ToString();

        switch (itemData[itemID].Item_type)
        {
        case Constants.ItemIndex.ARMOR:
            itemSprite.sprite = MasterManager.ManagerSprite.ArmorList[itemData[itemID].Sprite_index];
            break;

        case Constants.ItemIndex.HELMET:
            itemSprite.sprite = MasterManager.ManagerSprite.HelmetList[itemData[itemID].Sprite_index];
            break;

        case Constants.ItemIndex.LEFT_HAND:
            itemSprite.sprite = MasterManager.ManagerSprite.LeftHandList[itemData[itemID].Sprite_index];
            break;

        case Constants.ItemIndex.PANTS:
            itemSprite.sprite = MasterManager.ManagerSprite.PantsList[itemData[itemID].Sprite_index];
            break;

        case Constants.ItemIndex.RIGHT_HAND:
            itemSprite.sprite = MasterManager.ManagerSprite.RightHandList[itemData[itemID].Sprite_index];
            break;

        case Constants.ItemIndex.SHOES:
            itemSprite.sprite = MasterManager.ManagerSprite.ShoesList[itemData[itemID].Sprite_index];
            break;
        }

        playerItems = MasterManager.ManagerGlobalData.GetPlayerDataInfo();
        playerItems.itemList.Add(itemData[itemID]);
    }