Example #1
0
    void Awake()
    {
        ConnectionCheck();
        if (!_hasInternetConnection)
        {
            useGoogleSheets = false;
        }

        //For google play store release
        useGoogleSheets = false;

        if (!useGoogleSheets)
        {
            return;
        }

        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Enemies"), UpdateEnemies);

        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Stats", "A3", "B4", "A", 3), UpdatePlayer);
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Stats", "A6", "D10", "A", 6), UpdatePlayerAbilities);

        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Trash", "A2", "A3", "A", 2), UpdateTower);
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Trash", "A27", "C28", "A", 27), UpdateTower2);
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Trash", "A27", "C28", "A", 27), UpdatePickUp);

        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Trash", "A6", "H16", "A", 6), UpdateTowerUpgrades);
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Trash", "A23", "B24", "A", 23), UpdateTrashCans);
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, "Trash", "A19", "C20", "A", 19), UpdateBarricades);
    }
 void UpdateStats()
 {
     if (sheetStatus == SheetStatus.PRIVATE)
     {
         SpreadsheetManager.Read(new GSTU_Search(associatedSheet, associatedWorksheet), UpdateAllAnimals);
     }
     else if (sheetStatus == SheetStatus.PUBLIC)
     {
         SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(associatedSheet, associatedWorksheet), UpdateAllAnimals);
     }
 }
 public void ReadInstancesSheet(string googleKey, string sheet, bool isPrivate)
 {
     if (isPrivate)
     {
         SpreadsheetManager.Read(new GSTU_Search(googleKey, sheet), onSheetInstancesRead);
     }
     else
     {
         SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(googleKey, sheet), onSheetInstancesRead);
     }
 }
Example #4
0
 public void DataDownload()
 {
     SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(SheetID, "Scenario", "A1", "Z1000"), (x) => OnReceiveScenario(x));
     SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(SheetID, "Job", "A1", "Z1000"), (x) => OnReceiveJob(x));
     //Scene
     //Place
     //Job
     //Item
     //Ability
     //Event
     //Enemy
 }
    //  Fill our item list with data from Google Doc
    private void FillItemList()
    {
        //  Do not re-fill the item list if user is not loading data AND has the BossSync option turned off
        if ((ProgramState.CurrentState != ProgramState.states.Drops) && !bool.Parse(ProgramControl.Options.GetOptionValue(BossSyncOption.Name())))
        {
            Debug.Log($"Not filling item list");
            return;
        }
        Debug.Log("filling item list");
        itemList.Clear();
        itemList.haveRareDropsBeenAdded = false;

        //  Read in the spreadsheet with item data for the new boss
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search
                                                     (sheetID, (CacheManager.currentBoss.bossName + " " + ProgramControl.Options.GetOptionValue(RSVersionOption.Name()))), itemList.FillItemList);
    }
Example #6
0
    //  Combine all lists into a single dictionary<int itemID, SetupItem item>
    public static void Setup(string sheetID)
    {
        //  Load food
        foreach (FoodSO foodData in items.foodList)
        {
            //  Make sure this itemID isn't already taken; typos or mistakes in data entry
            if (data.ContainsKey(foodData.itemID))
            {
                SetupItem item;
                data.TryGetValue(foodData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {foodData.itemName}, ID: {foodData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            Food food = new Food(foodData);
            foodList.Add(new SetupItemStruct(foodData.itemID, foodData.itemName));
            data.Add(food.itemID, food);
        }

        //  Load potions
        foreach (PotionSO potionData in items.potionList)
        {
            if (data.ContainsKey(potionData.itemID))
            {
                SetupItem item;
                data.TryGetValue(potionData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {potionData.itemName}, ID: {potionData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            Potion potion = new Potion(potionData);
            potionList.Add(new SetupItemStruct(potionData.itemID, potionData.itemName));
            data.Add(potion.itemID, potion);
        }

        //  Load pouches
        foreach (SummoningPouchSO pouchData in items.summoningPouchList)
        {
            if (data.ContainsKey(pouchData.itemID))
            {
                SetupItem item;
                data.TryGetValue(pouchData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {pouchData.itemName}, ID: {pouchData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            SummoningPouch pouch = new SummoningPouch(pouchData);
            pouchList.Add(new SetupItemStruct(pouchData.itemID, pouchData.itemName));
            data.Add(pouch.itemID, pouch);
        }

        //  Load scrolls
        foreach (SummoningScrollSO scrollData in items.summoningScrollList)
        {
            if (data.ContainsKey(scrollData.itemID))
            {
                SetupItem item;
                data.TryGetValue(scrollData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {scrollData.itemName}, ID: {scrollData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            SummoningScroll scroll = new SummoningScroll(scrollData);
            scrollList.Add(new SetupItemStruct(scrollData.itemID, scrollData.itemName));
            data.Add(scroll.itemID, scroll);
        }

        //  Load nondegradeable armour
        foreach (NondegradeArmourSO armourData in items.nondegradeArmourList)
        {
            if (data.ContainsKey(armourData.itemID))
            {
                SetupItem item;
                data.TryGetValue(armourData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {armourData.itemName}, ID: {armourData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            NondegradableArmour armour = new NondegradableArmour(armourData);
            data.Add(armour.itemID, armour);
            AddToArmourList(new SetupItemStruct(armour.itemID, armour.itemName), armour.GetItemCategory());
        }

        //  Load augmented armour
        foreach (AugArmourSO armourData in items.augmentedArmourList)
        {
            if (data.ContainsKey(armourData.itemID))
            {
                SetupItem item;
                data.TryGetValue(armourData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {armourData.itemName}, ID: {armourData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            AugmentedArmour armour = new AugmentedArmour(armourData);
            data.Add(armour.itemID, armour);
            AddToArmourList(new SetupItemStruct(armour.itemID, armour.itemName), armour.GetItemCategory());
        }

        //  Load degradable armour
        foreach (DegradableArmourSO armourData in items.degradableArmourList)
        {
            if (data.ContainsKey(armourData.itemID))
            {
                SetupItem item;
                data.TryGetValue(armourData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {armourData.itemName}, ID: {armourData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            DegradableArmour armour = new DegradableArmour(armourData);
            data.Add(armour.itemID, armour);
            AddToArmourList(new SetupItemStruct(armour.itemID, armour.itemName), armour.GetItemCategory());
        }

        //  Load time-degrade armour
        foreach (TimeDegradeArmourSO armourData in items.timeDegradeArmourList)
        {
            if (data.ContainsKey(armourData.itemID))
            {
                SetupItem item;
                data.TryGetValue(armourData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {armourData.itemName}, ID: {armourData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            //create and add armour
            TimeDegradeArmour armour = new TimeDegradeArmour(armourData);
            data.Add(armour.itemID, armour);
            AddToArmourList(new SetupItemStruct(armour.itemID, armour.itemName), armour.GetItemCategory());
        }

        //  Load nondegradable weapons
        foreach (NondegradeWeaponSO weaponData in items.nondegradeWeaponList)
        {
            if (data.ContainsKey(weaponData.itemID))
            {
                SetupItem item;
                data.TryGetValue(weaponData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {weaponData.itemName}, ID: {weaponData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            NondegradableWeapon weapon = new NondegradableWeapon(weaponData);
            data.Add(weapon.itemID, weapon);
            AddToWeaponList(new SetupItemStruct(weapon.itemID, weapon.itemName), weapon.GetItemCategory());
        }

        //  Load augmented weapons
        foreach (AugWeaponSO weaponData in items.augmentedWeaponList)
        {
            if (data.ContainsKey(weaponData.itemID))
            {
                SetupItem item;
                data.TryGetValue(weaponData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {weaponData.itemName}, ID: {weaponData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            AugmentedWeapon weapon = new AugmentedWeapon(weaponData);
            data.Add(weapon.itemID, weapon);
            AddToWeaponList(new SetupItemStruct(weapon.itemID, weapon.itemName), weapon.GetItemCategory());
        }

        //  Load degradable weapons
        foreach (DegradableWeaponSO weaponData in items.degradableWeaponList)
        {
            if (data.ContainsKey(weaponData.itemID))
            {
                SetupItem item;
                data.TryGetValue(weaponData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {weaponData.itemName}, ID: {weaponData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            DegradableWeapon weapon = new DegradableWeapon(weaponData);
            data.Add(weapon.itemID, weapon);
            AddToWeaponList(new SetupItemStruct(weapon.itemID, weapon.itemName), weapon.GetItemCategory());
        }

        //  Load general items
        foreach (GeneralItemSO generalItemData in items.generalItemList)
        {
            if (data.ContainsKey(generalItemData.itemID))
            {
                SetupItem item;
                data.TryGetValue(generalItemData.itemID, out item);
                Debug.Log($"Trying to add item [ Name: {generalItemData.itemName}, ID: {generalItemData.itemID} ] failed!  Item [ Name: {item.itemName} ] with that ID already exists!");
                continue;
            }

            General genItem = new General(generalItemData);
            data.Add(genItem.itemID, genItem);
            generalItemList.Add(new SetupItemStruct(genItem.itemID, genItem.itemName));
        }

        //  Unload the ScriptableObjects collection
        Resources.UnloadAsset(items);

        //  Sort each list alphabetically
        foreach (List <SetupItemStruct> list in listSetupItemStructLists)
        {
            list.Sort();
        }

        //  Load prices from GDoc
        SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(sheetID, SHEETNAME, STARTCELL, ENDCELL), LoadPrices);
    }
Example #7
0
 public void Test()
 {
     SpreadsheetManager.ReadPublicSpreadsheet(new GSTU_Search(SheetID, "Place", "A1", "Z1000"), (x) => OnReceive(x));
 }