Esempio n. 1
0
 public override void onCall()
 {
     if (Game.game.currentQuestInstance == null)
     {
         DataGame.writeSaveGame(Game.game.saveGameSlot);
     }
 }
Esempio n. 2
0
    public void playOnSlot(Object o)
    {
        GameSlot gs = o as GameSlot;

        currentProfileSlot = gs.index;

        if (saveGameDescription[currentProfileSlot].empty || saveGameDescription[currentProfileSlot].corrupt)
        {
                        #if UNITY_ANDROID
            Muneris.CloseAds();
            Muneris.LogEvent("BTN_NEW_SLOT");
                        #endif
            DataGame.newSaveGame(currentProfileSlot);
            Game.game.saveGameSlot = currentProfileSlot;
            startGame();
        }
        else
        {
                        #if UNITY_ANDROID
            Muneris.CloseAds();
                        #endif
            Game.game.resetData();
            Game.game.saveGameSlot = currentProfileSlot;
            DataGame.loadSaveGame(currentProfileSlot);
        }
    }
Esempio n. 3
0
        public void Construct(SignalBus signalBus, DataGame dataGame)
        {
            this.signalBus = signalBus;
            this.dataGame  = dataGame;

            Init();
        }
Esempio n. 4
0
        /// <summary>
        ///     Initialize table with decryption constants
        /// </summary>
        /// <param name="data"></param>
        /// <param name="game"></param>
        /// <param name="flags"></param>
        /// <param name="truth"></param>
        /// <param name="multiplier"></param>
        /// <param name="divisor"></param>
        public PKGTBL(Span <byte> data, DataGame game, IDTableFlags flags, byte[] truth, ulong multiplier, ulong divisor)
        {
            if (flags != IDTableFlags.None)
            {
                var size = BinaryPrimitives.ReadUInt32LittleEndian(data);
                data = Read(data.Slice(4), game, (uint)data.Length - 4, size, flags, truth, multiplier, divisor);
            }

            Buffer = new Memory <byte>(data.ToArray());
            if (data.GetDataType() == DataType.PackageInfo)
            {
                PackageInfo = new PKGINFO(data);
                // There's extra shit that I can't parse yet because the format is highly dependent on arbitrary values.
                Header = new IDTableHeader
                {
                    Offset = PackageInfo.Resource.Pointers[1] + PackageInfo.InfoTable.Header.TextPointer + SizeHelper.SizeOf <BTIFHeader>()
                };
                Entries = PackageInfo.InfoTable.Entries.Select(x => new IDTableEntry
                {
                    PathOffset         = x.NameOffset,
                    OriginalPathOffset = -1,
                    Flags            = x.Flags,
                    Checksum         = x.Checksum,
                    CompressedSize   = x.CompressedSize,
                    DecompressedSize = x.DecompressedSize,
                    Padding1         = PackageInfo.InfoTable.UnknownBuffer[x.UnknownIndex],
                    Padding2         = PackageInfo.InfoTable.UnknownBuffer[x.UnknownIndex + 1]
                }).ToArray();
            }
            else
            {
                Header  = MemoryMarshal.Read <IDTableHeader>(data);
                Entries = MemoryMarshal.Cast <byte, IDTableEntry>(data.Slice(Header.Offset, Header.Count * SizeHelper.SizeOf <IDTableEntry>())).ToArray();
            }
        }
Esempio n. 5
0
    void drawNewGameData()
    {
        if (inTransition(MainMenu.MainMenuScreens.IsData, newGameScreenButtonInitialPos, newGameScreenButtonDestinyPos, ref newGameScreenButtonsCurrentPos))
        {
            Rect buttonRectProperties = new Rect(0, 0, defaultButtonDimension.x, defaultButtonDimension.y);

            buttonRectProperties.x = newGameScreenButtonsCurrentPos.x;
            buttonRectProperties.y = newGameScreenButtonsCurrentPos.y + 0.051f;


            fontInResolution = textFont("[F ButtonFontSmall]", "[F ButtonFontMidle]", "[F ButtonFontBig]", "[F ButtonFontBig32]");

            showLabelFormat(ref overwriteGameLabel, overWriteMessageRect, fontInResolution + "[HA C][c FFFFFFFF]" + overwriteGameText.text + fontInResolution,
                            new string[] { "ButtonFontSmall", "ButtonFontMidle", "ButtonFontBig", "ButtonFontBig32" });

            buttonRectProperties.y += distanceBetweenButtons;

            showButton(buttonRectProperties, yesText.text, style, delegate(Object o)
            {
                Game.game.saveGameSlot = currentProfileSlot;
                DataGame.newSaveGame(currentProfileSlot);
                startGame();
            });

            buttonRectProperties.y += distanceBetweenButtons;

            showButton(buttonRectProperties, noText.text, style, gotoNewGameScreen);
        }
    }
Esempio n. 6
0
 public void AcceptSideQuest()
 {
     destroyWindowQuest();
     DataGame.writeSaveGame(Game.game.saveGameSlot);
     Game.game.startSideQuest();
     Game.game.questDifficultyFactor = 1.4f + 0.003f * (float)(Game.game.gameStats.level - 15) - 0.0006f * Mathf.Pow((float)(Game.game.gameStats.level - 15), 2.0f);
     Game.game.questExperienceFactor = 0.7f;
 }
Esempio n. 7
0
 public virtual void Setup(EcsWorld world, DataGame dataGame, Camera mainCamera, GamePool pool)
 {
     this.world      = world;
     dataTank        = dataGame.PlayerTank;
     weapon          = dataGame.SimpleTankWeapon;
     this.mainCamera = mainCamera;
     this.pool       = pool;
 }
Esempio n. 8
0
    void SaveSudoku()
    {
        DataGame game = new DataGame();

        game.blocks = new List <DataBlock>();
        blocks.ForEach((obj) => game.blocks.Add(obj.DataBlock));
        SudokuGameManager.SavedGame = game;
    }
Esempio n. 9
0
    public static void Save(DataGame dataGame)
    {
        savedGames.Add(dataGame);                                                                                          // Add current game to the list saved games
        BinaryFormatter bf   = new BinaryFormatter();                                                                      // Serialization work
        FileStream      file = File.Create(Application.persistentDataPath + Path.DirectorySeparatorChar + "savedata.upc"); // Send the current game data and saved the file savegame.gd in unity's path by default -> you can put any extension

        bf.Serialize(file, Serialization.savedGames);                                                                      // Saved the file in our list of saved games
        file.Close();
    }
Esempio n. 10
0
 public void Setup(EcsWorld world, DataGame dataGame, Camera mainCamera, GamePool pool, Transform[] waitpoints)
 {
     this.world      = world;
     dataTank        = GetRandomEnemy(dataGame);
     weapon          = dataGame.SimpleTankWeapon;
     this.mainCamera = mainCamera;
     this.pool       = pool;
     this.waitpoints = waitpoints;
 }
Esempio n. 11
0
    public void SaveData(string path, int datasave)
    {
        DataGame save = new DataGame {
            Score = datasave
        };
        string json = JsonUtility.ToJson(save);

        File.WriteAllText(Application.dataPath + "/Resources/" + path, json);
    }
Esempio n. 12
0
 public void Init(DataGame dataCities, Vector3 earth)
 {
     _earth          = earth;
     _targetFinder   = GetComponent <TargetFinder>();
     _rocketPrep     = GetComponent <RocketPrep>();
     _cityCondition  = GetComponent <CityCondition>();
     _dataCities     = dataCities;
     _flightAltitude = UnityEngine.Random.Range(5, 25);
 }
Esempio n. 13
0
    public static void Save(Initialization dataGame)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/game.sav";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        DataGame data = new DataGame(dataGame);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Esempio n. 14
0
 public void eraseYes()
 {
             #if UNITY_ANDROID
     Muneris.LogEvent("BTN_DELETE_SLOT");
             #endif
     DataGame.eraseSaveGame(slotToErase);
     saveGameDescription[slotToErase].reset();
     transitionFrom = currentScreen;
     currentScreen  = MainMenuScreens.Transition;
     transitionTo   = MainMenuScreens.NewGameScreen;
 }
Esempio n. 15
0
 public static GameItem Create(DataGame data, Transform parent)
 {
     GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/WorldGame/GameItem"));
     obj.name = "00" + data.roomId + " - " + data.roomName;
     obj.transform.parent = parent;
     obj.transform.localPosition = Vector3.zero;
     obj.transform.localScale = Vector3.one;
     GameItem item = obj.GetComponent<GameItem>();
     item.Presenter = new GameItemPresenter(item);
     item.setData(data);
     return item;
 }
Esempio n. 16
0
    public void createSaveGameDescriptions(ref GameDescription[] saveGameDescription)
    {
        for (int i = 0; i < saveGameDescription.Length; i++)
        {
            saveGameDescription[i] = new GameDescription();

            if (DataGame.saveGameExist(i))
            {
                DataGame.fillGameDescription(i, ref saveGameDescription[i]);
            }
        }
    }
Esempio n. 17
0
    private GameObject CreateCity(GameObject cityTemplate, float earthRadius, DataGame dataCities)
    {
        GameObject city;
        Vector3    positionSpawn = Random.onUnitSphere * earthRadius;

        city = Instantiate(cityTemplate, positionSpawn, Quaternion.identity);
        city.GetComponent <RocketLaunch>().Init(dataCities, transform.position);
        city.GetComponent <TargetFinder>().Init(dataCities, dataCities.AmountTargets);
        city.GetComponent <CityCondition>().Init(dataCities);
        city.GetComponent <RocketPrep>().Init();
        return(city);
    }
        private void GetImages(RomData dataToFillOut, Data resultsData, DataGame game)
        {
            String baseImgUrl = resultsData.baseImgUrl;

            if (game.Images?.Count() > 0)
            {
                var images = game.Images[0];
                GetBoxart(dataToFillOut, baseImgUrl, images);
                GetBackground(dataToFillOut, baseImgUrl, images);
                GetBanner(dataToFillOut, baseImgUrl, images);
                GetLogo(dataToFillOut, baseImgUrl, images);
            }
        }
Esempio n. 19
0
    private void PreSaveGameData()
    {
        DataGame       dt = dataGame.dataGame;
        GameController gc = GameController.instance;

        dt.lastTimeOn = JsonUtility.ToJson((JsonDateTime)DateTime.Now);

        dt.saude       = gc.saude;
        dt.energia     = gc.energia;
        dt.dormindo    = gc.dormindo;
        dt.alimentacao = gc.alimentacao;
        dt.diversao    = gc.diversao;
        dt.higiene     = gc.higiene;
    }
Esempio n. 20
0
    public void loadGame(Object o)
    {
        GameSlot gs = o as GameSlot;

        currentProfileSlot = gs.index;

        Game game = Game.game;

        game.resetData();

        Game.game.saveGameSlot = currentProfileSlot;

        DataGame.loadSaveGame(currentProfileSlot);
    }
Esempio n. 21
0
 public void doExchange()
 {
             #if UNITY_ANDROID
     Muneris.LogEvent("BTN_EXCHANGE_GOLD");
             #endif
     Game.game.gameStats.gems  -= gemsAmount;
     Game.game.gameStats.coins += coinsAmount;
     GameObject windowExchangeGems = GameObject.Find("windowExchangeGems");
     if (windowExchangeGems != null)
     {
         GameObject.Destroy(windowExchangeGems);
     }
     DataGame.writeSaveGame(Game.game.saveGameSlot);
 }
Esempio n. 22
0
    public static GameItem Create(DataGame data, Transform parent)
    {
        GameObject obj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/WorldGame/GameItem"));

        obj.name                    = "00" + data.roomId + " - " + data.roomName;
        obj.transform.parent        = parent;
        obj.transform.localPosition = Vector3.zero;
        obj.transform.localScale    = Vector3.one;
        GameItem item = obj.GetComponent <GameItem>();

        item.Presenter = new GameItemPresenter(item);
        item.setData(data);
        return(item);
    }
Esempio n. 23
0
    public void LoadGameSaved()
    {
        DataGame dt = SaveGameController.Instance.dataGame.dataGame;

        int      coins       = dt.coins;
        float    saude       = dt.saude;
        float    energia     = dt.energia;
        bool     dormindo    = dt.dormindo;
        float    alimentacao = dt.alimentacao;
        float    diversao    = dt.diversao;
        float    higiene     = dt.higiene;
        DateTime lastTimeOn  = JsonUtility.FromJson <JsonDateTime>(dt.lastTimeOn);

        Debug.Log("Goo Log || Last time on :" + lastTimeOn);
        float pastSeconds = (float)((DateTime.Now - lastTimeOn).TotalSeconds);

        this.coins = coins;

        this.saude = saude - (pastSeconds * gastSaude);
        if (!dormindo)
        {
            this.energia = energia - (pastSeconds * gastEnergia);
        }
        else
        {
            this.energia = energia + (pastSeconds * gainEnergia);
        }
        this.alimentacao = alimentacao - (pastSeconds * gastAlimentacao);
        this.diversao    = diversao - (pastSeconds * gastDiversao);
        this.higiene     = higiene - (pastSeconds * gastHigiene);

        this.dormindo = dormindo;
        alphaSleep.SetActive(dormindo);
        if (dormindo)
        {
            Player.instance.p_animator.SetTrigger("goSleep");
            SetLocal(Locais.Quarto);
        }
        else
        {
            Player.instance.p_animator.SetTrigger("wakeUp");
        }

        this.textCoins.text = this.coins.ToString();
        OnLoadInstatiatePP(pastSeconds);
        SetBarras();
        inGame = true;
        FadeInOut.instance.FadeOut(1, 1);
    }
Esempio n. 24
0
    public int LoadDataHightScore(string path)
    {
        if (!File.Exists(Application.dataPath + "/Resources/" + path))
        {
            FileStream file = File.Create(Application.dataPath + "/Resources/" + path);
            file.Close();
        }
        else
        {
            var data_ = File.ReadAllText(Application.dataPath + "/Resources/" + path);
            data = JsonUtility.FromJson <DataGame>(data_);

            return(data.Score);
        }
        return(0);
    }
Esempio n. 25
0
    public override void TUpdate()
    {
        base.TUpdate();

        if (runningTutorial)
        {
            if (!Game.game.currentDialog)
            {
                TownGui.currentShopKeeper = TownGui.SHOPKEEPERWINDOW.MERCHANT;
                Game.game.currentState    = Game.GameStates.InTownKeeper;
                completed       = true;
                runningTutorial = false;
                DataGame.writeSaveGame(Game.game.saveGameSlot);
            }
        }
    }
Esempio n. 26
0
    void LoadGame(DataGame game, int index)
    {
        Debug.Log("Load game");
        //todo add comment
        if (File.Exists(Application.dataPath + "/recordingData.txt"))
        {
            string savedData = File.ReadAllText(Application.dataPath + "/recordingData.txt");
            loadedSavedTime = JsonUtility.FromJson <GameTimeRecord>(savedData);
            GameTimeRecord.GameTimeRecorded = loadedSavedTime.sudokuTimePlayed;
            Debug.Log("Load recorded time : " + RecordCrosswordTime.GameTimeRecorded);
            Debug.Log("loadedSavedTime : " + loadedSavedTime.crosswordTimePlayed);
        }
        else
        {
            loadedSavedTime = new GameTimeRecord()
            {
                crosswordTimePlayed = 0,
                sudokuTimePlayed    = 0,
                pacmanTimePlayed    = 0
            };
        }


        for (int i = 0; i < game.blocks.Count; i++)
        {
            blocks[i].DataBlock = game.blocks[i];
        }
        UpdateUI();
        UpdateAllBlockUI();
        SudokuGameManager.SavedGame  = game;
        SudokuGameManager.LastLoaded = index;
        stateList.Clear();

        UpdateAllBlockUI();
        if (!SudokuGameManager.IsGamePause)
        {
            StartCoroutine(PlayNewGameAnimation());
        }

        Timer.Schedule(this, 1f, () =>
        {
            CUtils.ShowInterstitialAd();
        });
    }
Esempio n. 27
0
    public static DataGame Load()
    {
        string path = Application.persistentDataPath + "/game.sav";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);
            DataGame        data      = formatter.Deserialize(stream) as DataGame;
            stream.Close();

            return(data);
        }
        else
        {
            Debug.LogError("save file not found in " + path);
            return(null);
        }
    }
Esempio n. 28
0
    void onPurchaseSucceeded(string itemName)
    {
        for (int i = 0; i < GemsStoreGui.Products.Length; i++)
        {
            if (itemName == GemsStoreGui.Products[i])
            {
                string eventName = "PURCHASE_SUCCESS_PACK_" + (i + 1).ToString();
                Muneris.LogEvent(eventName);
                Game.game.gameStats.gems += GemsStoreGui.gemPackValues[i];
                //PopUpMessage.MsgBoxOk("Prefabs/Hud/GemsStatusMessage",AcquiredString.text+" " + gemPackValues[i] + " "+ GemsString.text,delegate(){});
                break;
            }
        }

        DataGame.writeSaveGame(Game.game.saveGameSlot);

        //Debug.Log("Purchase succeeded: " + itemName);
        Muneris.DisplayAlert("Purchase Succeeded", "Purchase has succeeded for item: " + itemName, null, new string[] { "Okay" });
    }
        protected override RomData ScraperSpecificGetAllData(RomData dataToFillOut)
        {
            String getDataTerm = String.Format(getDataFormat, dataToFillOut.ScraperUniqueKey);
            String finalUrl    = String.Format("{0}{1}", rootUrl, getDataTerm);
            String results     = MakeTextRequest(finalUrl);

            if (results != String.Empty)
            {
                Data     resultsData = SerializationUtilities.DeserializeString <Data>(results, DataFormat.XML);
                DataGame game        = resultsData.Game[0];
                dataToFillOut.Rating      = String.IsNullOrEmpty(game.Rating) ? 0.0f : float.Parse(game.Rating);
                dataToFillOut.Publisher   = game.Publisher;
                dataToFillOut.Developer   = game.Developer;
                dataToFillOut.Description = game.Overview;
                dataToFillOut.NumPlayers  = game.Players;

                GetImages(dataToFillOut, resultsData, game);
            }
            return(dataToFillOut);
        }
Esempio n. 30
0
    /// <summary>
    /// Loads the game data.
    /// </summary>
    /// <param name="gameDataFileName">Filename of the JSON file containing the game data.</param>
    public void loadGameData(string gameDataFileName)
    {
        string filePath = Path.Combine(Application.streamingAssetsPath, gameDataFileName);

        if (File.Exists(filePath))
        {
            string   dataAsJson = File.ReadAllText(filePath);
            DataGame loadedData = JsonUtility.FromJson <DataGame>(dataAsJson);

            teachinglanguage = loadedData.teachinglanguage;
            learninglanguage = loadedData.learninglanguage;
            intro            = loadedData.intro;
            allLectures      = loadedData.allLectures;
            outro            = loadedData.outro;
        }
        else
        {
            Debug.LogError("GameData not found!");
        }
    }
Esempio n. 31
0
    /// <summary>
    /// Use food
    /// </summary>
    public void UseFood(Comida food)
    {
        DataGame _game = SaveGameController.Instance.dataGame.dataGame;
        int      i     = GetFoodItem(food);

        if (i >= 0)
        {
            _game.foods[i].Quantidade--;
            if (_game.foods[i].Quantidade <= 0)
            {
                _game.foods.RemoveAt(i);
            }
        }
        else
        {
            return;
        }

        SaveGameController.Instance.SaveGame();
    }
Esempio n. 32
0
 public void setData(DataGame data)
 {
     presenter.Data = data;
 }