示例#1
0
    private void SaveTimers()
    {
        List <string> list  = new List <string>();
        List <string> list2 = new List <string>();

        foreach (string text in this.timers.Keys)
        {
            if (this.timers[text].Remove)
            {
                list.Add(text);
            }
            else
            {
                list2.Add(text);
            }
        }
        for (int i = 0; i < list.Count; i++)
        {
            this.timers.Remove(list[i]);
            GameProgress.RemoveTimerData(list[i], "date");
        }
        GameProgress.SetTimerIds(list2.ToArray());
        for (int j = 0; j < list2.Count; j++)
        {
            GameProgress.SetTimerData(list2[j], "date", TimeManager.ConvertDateTime2Seconds(this.timers[list2[j]].Date));
        }
    }
示例#2
0
    private void GiveReward(DailyRewardBundle rewardBundle)
    {
        if (rewardBundle == null)
        {
            return;
        }
        List <DailyReward> list = rewardBundle.GetRewards(RewardSystem.CurrentRewardStatus.PendingRewardLevel);

        if (list == null)
        {
            return;
        }
        for (int i = 0; i < list.Count; i++)
        {
            DailyReward dailyReward      = list[i];
            string      customTypeOfGain = "Odyssey daily reward";
            switch (dailyReward.prize)
            {
            case PrizeType.SuperGlue:
                GameProgress.AddSuperGlue(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperGlueSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.SuperMagnet:
                GameProgress.AddSuperMagnet(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.SuperMagnetSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.TurboCharge:
                GameProgress.AddTurboCharge(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.TurboChargeSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.SuperMechanic:
                GameProgress.AddBluePrints(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.BlueprintSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;

            case PrizeType.NightVision:
                GameProgress.AddNightVision(dailyReward.prizeCount);
                if (Singleton <IapManager> .Instance != null)
                {
                    Singleton <IapManager> .Instance.SendFlurryInventoryGainEvent(IapManager.InAppPurchaseItemType.NightVisionSingle, dailyReward.prizeCount, customTypeOfGain);
                }
                break;
            }
        }
    }
示例#3
0
    private bool IsSaleOn(string saleItemKey, out int saleLeft)
    {
        GameConfigurationManager instance = Singleton <GameConfigurationManager> .Instance;
        ConfigData config = instance.GetConfig("iap_sale_items");

        if (!Singleton <IapManager> .Instance.HasProduct(this.saleItem))
        {
            saleLeft = -1;
            return(false);
        }
        if (config != null)
        {
            for (int i = 0; i < config.Keys.Length; i++)
            {
                if (config.Keys[i].StartsWith(saleItemKey))
                {
                    string[] array = config[config.Keys[i]].Split(new char[]
                    {
                        '-'
                    });
                    int saleTimeLeft = Shop.GetSaleTimeLeft(array[0], (array.Length <= 1) ? string.Empty : array[1]);
                    if (saleTimeLeft > 0 && !GameProgress.GetBool(config.Keys[i] + "_used", false, GameProgress.Location.Local, null))
                    {
                        saleLeft            = saleTimeLeft;
                        this.currentSaleKey = config.Keys[i];
                        return(true);
                    }
                }
            }
        }
        saleLeft = -1;
        return(false);
    }
示例#4
0
    void Start()
    {
        var sceneName = LevelManagerSingleton.Instance.loadedScene;
        gameProgress = GameProgress.Load ();
        if (sceneName != "level_complete") {   //Check that we are not loading level_complete as a standalone in the editor
            //Upper left panel
            var timeTaken = LevelManagerSingleton.Instance.ElapsedTime ();
            var medalThisTime = gameProgress.GetMedalAttained (sceneName, timeTaken);
            var personalBest = gameProgress.GetLevelBestTime (sceneName);
            var personalBestMedal = gameProgress.GetMedalAttained (sceneName);
            var difference = timeTaken - personalBest;
            var parityString = (difference > 0) ? "+" : "-";
            differenceText.text = "(" + parityString + StopWatch.Format(difference) + ")";
            thisTime.text = StopWatch.Format (timeTaken);
            fastestTime.text = StopWatch.Format (personalBest);
            AssignMedalSprite(fastestTimeImage, personalBestMedal);
            AssignMedalSprite(thisTimeImage, medalThisTime);
            AssignMedalSprite(medalAwarded, personalBestMedal);

            //Upper right panel
            goldTimeText.text = StopWatch.Format(gameProgress.GetGoldMedalTime(sceneName));
            silverTimeText.text = StopWatch.Format(gameProgress.GetSilverMedalTime(sceneName));
            bronzeTimeText.text = StopWatch.Format(gameProgress.GetBronzeMedalTime(sceneName));
        }
    }
示例#5
0
    public void LoadData()
    {
        //Sound volume

        mainVolume = 1f;
        bgmVolume  = PlayerPrefs.GetFloat(keyBgmVolume, 0.6f);
        efxVolume  = PlayerPrefs.GetFloat(keyEfxVolume, 0.8f);
        SoundManager.instance.MainVolume = mainVolume;
        SoundManager.instance.BgmVolume  = bgmVolume;
        SoundManager.instance.EfxVolume  = efxVolume;

        //Mode options

        gameLevel         = PlayerPrefs.GetInt("GameLevel", 1);
        screenGridOn      = PlayerPrefs.GetInt("ScreenGridOn", 1);
        rgbChannelOn      = PlayerPrefs.GetInt("RGBChannelOn", 1);
        fadeBorderOn      = PlayerPrefs.GetInt("FadeBorderOn", 1);
        miscEffectLevel   = PlayerPrefs.GetInt("MiscEffectLevel", 2);
        directionAdjustOn = PlayerPrefs.GetInt("DirectionAdjustOn", 1);

        //Game progress

        lastPlayProgress = GameProgresses[PlayerPrefs.GetInt("LastPlay", 0)];
        unlockedProgress = GameProgresses[PlayerPrefs.GetInt("Unlocked", 0)];
    }
示例#6
0
 private void LoadData()
 {
     this.PendingExperience = GameProgress.GetInt("player_pending_experience", -1, GameProgress.Location.Local, null);
     this.Experience        = GameProgress.GetInt("player_experience", 0, GameProgress.Location.Local, null);
     this.Level             = GameProgress.GetInt("player_level", 1, GameProgress.Location.Local, null);
     this.FirePlayerProgressEvent();
 }
示例#7
0
    //
    // public void setPin()
    //
    // Player clicked on the pin sidebar
    // This method finds the first empty Pin slot and sets the color
    //
    public void setPin(int pinColor)
    {
        // find the actual row
        GameObject row = GameObject.Find("row-" + currentMove);

        megaMind.GameProgress.CurrentRow = currentMove;

        // find the first empty pin
        int col = 0;

        foreach (Transform child in row.transform)
        {
            col++;
            Image picture = child.GetComponent <Image>();
            if (picture.sprite == pinImages[0])
            {
                megaMind.GameProgress.CurrentCol = col;
                GameProgress.CurrentCol          = col;
                GameProgress.Write(new EventRecord()
                {
                    EventName = "PickColor", GameNumber = GameOfMatch, Color = pinColor.ToString()
                });

                picture.sprite = pinImages[pinColor];
                return;
            }
        }
    }
    public static GameProgress FromString(string s)
    {
        GameProgress gp = new GameProgress();

        string[] p = s.Split(new char[] { ':' });
        if (!p[0].StartsWith("GPv"))
        {
            Debug.LogError("Failed to parse game progress from: " + s);
            return(gp);
        }
        gp.mPilotExp = System.Convert.ToInt32(p[1]);
        int i;

        for (i = 2; i < p.Length && i - 2 < LevelCount; i++)
        {
            gp.GetLevelProgress(i - 2).SetFromString(p[i]);
        }
        if (p[0].Equals("GPv3"))
        {
            double val = Double.Parse(p[p.Length - 1]);
            gp.mPlayingTime = TimeSpan.FromMilliseconds(val > 0f?val:0f);
        }
        else
        {
            gp.mPlayingTime = new TimeSpan();
        }
        gp.mLoadedTime = DateTime.Now;
        return(gp);
    }
示例#9
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
示例#10
0
 protected void ChangePanelCallBack(UIPanelType otherType, string sceneName, GameProgress progrossname)
 {
     uIManager.UIPanelDict[currentUIPanel].Hide();
     GameManager.Instance.AsyncLoadScene(sceneName, progrossname);
     uIManager.UIPanelDict[otherType].Show();
     uIManager.UIPanelDict[otherType].EnterPanel();
 }
 public void RestoreFromGameProgress(GameProgress progress)
 {
     Reset();
     Turn         = progress.Turn;
     BlackPoints  = progress.BlackPoints;
     WhitePoints  = progress.WhitePoints;
     _gameOptions = progress.GameOptions;
     MoveNextDiscToCell(OthelloColor.White, GetCell(3, 3));
     MoveNextDiscToCell(OthelloColor.Black, GetCell(3, 4));
     MoveNextDiscToCell(OthelloColor.Black, GetCell(4, 3));
     MoveNextDiscToCell(OthelloColor.White, GetCell(4, 4));
     foreach (var progressCell in progress.Cells)
     {
         var cell = GetCell(progressCell.Column, progressCell.Row);
         Debug.WriteLine($"Restore cell R{progressCell.Row},C{progressCell.Column} {progressCell.DiscColor}");
         if (cell.Disc == null)
         {
             MoveNextDiscToCell(progressCell.DiscColor, cell);
         }
         else if (cell.Disc.DiscColor != progressCell.DiscColor)
         {
             FlipCellDisc(cell);
         }
     }
     if (_gameOptions.IsSinglePlayer && Turn == OthelloColor.Black)
     {
         GameState = GameStateEnum.WaitingDevice;
         Device.StartTimer(TimeSpan.FromMilliseconds(1000), DevicePlayCallback);
     }
     else
     {
         GameState = GameStateEnum.WaitingPlayerPlay;
     }
 }
示例#12
0
    // Use this for initialization
    void Awake()
    {
        stage = GameObject.Find("Stage").gameObject;
        hero  = stage.transform.Find("Hero").gameObject;
        goal  = stage.transform.Find("Goal").gameObject;

        progress      = GameProgress.Initial;
        menuPauseFlag = false;
        heroStopFlag  = true;
        GameObject canvas = transform.Find("Canvas").gameObject;

        pauseButton      = canvas.transform.Find("PauseButton").gameObject;
        modeTrigger      = canvas.transform.Find("ModeTrigger").gameObject;
        pauseMenu        = canvas.transform.Find("PauseMenu").gameObject;
        clearMenu        = canvas.transform.Find("ClearMenu").gameObject;
        overMenu         = canvas.transform.Find("OverMenu").gameObject;
        translucentPanel = canvas.transform.Find("TranslucentPanel").gameObject;

        drawMode = false;

        // サウンド追加
        if (!soundDebug)
        {
            SoundManager.Instance.Play();
            SoundManager.Instance.SetEndFlag(false);
        }
    }
示例#13
0
    //
    // public void newGame()
    //
    // Player chose to start a new game
    //

    public void newGame()
    {
        panelGameOver.gameObject.SetActive(false);
        panelGameWon.gameObject.SetActive(false);
        secret.gameObject.SetActive(true);

        GameOfMatch++;
        if (GameOfMatch > GamesPerMatch)
        {
            GameProgress.Write(new EventRecord()
            {
                EventName = "MatchComplete", GameNumber = GameOfMatch
            });

            showMenu();
        }
        else
        {
            GameProgress.Write(new EventRecord()
            {
                EventName = "NewGame", GameNumber = GameOfMatch
            });

            initGame();
        }
    }
示例#14
0
    private void Awake()
    {
        MainMenu.isGameHallExitOpened = false;
        this.shopButton = GameObject.Find("MainShopButton");
        this.m_crossPromotionOverlay = UnityEngine.Object.Instantiate <GameObject>(this.m_crossPromotionOverlay);
        this.m_crossPromotionOverlay.SetActive(false);
        if (this.m_settingsPopup != null)
        {
            this.m_settingsPopup.SetActive(false);
        }
        if (Singleton <BuildCustomizationLoader> .Instance.IAPEnabled)
        {
            if (GameProgress.GetSandboxUnlocked("S-F"))
            {
                this.m_iapButton.SetActive(false);
            }
        }
        else
        {
            this.m_iapButton.SetActive(false);
        }
        AnimatedButton animatedButton = this.cakeRaceButton;

        animatedButton.OnOpenAnimationEvent = (Action <Spine.Event>)Delegate.Combine(animatedButton.OnOpenAnimationEvent, new Action <Spine.Event>(this.OnCakeRaceUnlockAnimationEvent));
        HatchManager.onLoginSuccess         = (Action)Delegate.Combine(HatchManager.onLoginSuccess, new Action(this.HideLockScreen));
        HatchManager.onLoginFailed          = (Action)Delegate.Combine(HatchManager.onLoginFailed, new Action(this.HideLockScreen));
        HatchManager.onLogout = (Action)Delegate.Combine(HatchManager.onLogout, new Action(this.LoggedOut));
    }
示例#15
0
    public static bool IsLevelUnlocked(int episodeIndex, int levelIndex)
    {
        bool flag = LevelInfo.IsStarLevel(episodeIndex, levelIndex);

        if (GameProgress.AllLevelsUnlocked() || levelIndex == 0)
        {
            return(true);
        }
        if (Singleton <BuildCustomizationLoader> .Instance.CheatsEnabled && GameProgress.AllFreeLevelsUnlocked() && !LevelInfo.IsContentLimited(episodeIndex, levelIndex))
        {
            return(true);
        }
        int           index      = LevelInfo.PreviousNormalLevelIndex(episodeIndex, levelIndex);
        List <string> levelNames = LevelInfo.GetLevelNames(episodeIndex);
        bool          result     = GameProgress.IsLevelCompleted(levelNames[index]);

        if (!flag && !Singleton <BuildCustomizationLoader> .Instance.IsChina)
        {
            return(result);
        }
        if (!flag && Singleton <BuildCustomizationLoader> .Instance.IsChina)
        {
            return(true);
        }
        int num;
        int num2;

        LevelInfo.GetStarLevelStars(episodeIndex, levelIndex, out num, out num2);
        return(num >= num2);
    }
示例#16
0
 private void OnPurchaseSucceeded(IapManager.InAppPurchaseItemType type)
 {
     if (!string.IsNullOrEmpty(this.currentSaleKey) && type == this.saleItem)
     {
         GameProgress.SetBool(this.currentSaleKey + "_used", true, GameProgress.Location.Local);
     }
 }
示例#17
0
    public void Spin()
    {
        if (!this.initialized || this.spinner.IsSpinning)
        {
            return;
        }
        WheelSlot target = this.GetRewardSlot(0);

        if (target != null && GameProgress.UseSnoutCoins(this.currentPrice))
        {
            if (this.currentPrice > 0)
            {
                Singleton <AudioManager> .Instance.Spawn2dOneShotEffect(WPFMonoBehaviour.gameData.commonAudioCollection.snoutCoinUse);
            }
            SnoutButton.Instance.UpdateAmount(false);
            this.popup.SpinButtonEnabled = false;
            this.popup.DoneButtonEnabled = false;
            this.spinner.Spin(target, this.initialSpinTime, this.spinVelocity, this.decelerationRate, this.tickSoundRate, delegate
            {
                this.OnSpinEnd(target);
            });
            this.SendFlurryLootWheelSpinEvent(target, this.currentPrice);
        }
        else
        {
            Singleton <IapManager> .Instance.OpenShopPage(delegate
            {
                this.popup.gameObject.SetActive(true);
            }, "SnoutCoinShop");

            this.popup.gameObject.SetActive(false);
        }
    }
示例#18
0
    private void RewardPowerup(LootCrateRewards.Powerup powerup)
    {
        switch (powerup)
        {
        case LootCrateRewards.Powerup.Magnet:
            GameProgress.AddSuperMagnet(1);
            break;

        case LootCrateRewards.Powerup.Superglue:
            GameProgress.AddSuperGlue(1);
            break;

        case LootCrateRewards.Powerup.Turbo:
            GameProgress.AddTurboCharge(1);
            break;

        case LootCrateRewards.Powerup.Supermechanic:
            GameProgress.AddBluePrints(1);
            break;

        case LootCrateRewards.Powerup.NightVision:
            GameProgress.AddNightVision(1);
            break;
        }
    }
    private void Start()
    {
        this.ProgressInGame.IsPlayerDead = false;

        this.RegisterEvents();

        this.player     = GameObject.FindGameObjectWithTag(Resources.Tags.Player);
        this.shipEngine = GameObject.FindGameObjectWithTag(Resources.Tags.Ship).GetComponent <ShipEngineScript>();
        this.tasks      = GameObject.FindGameObjectWithTag(Resources.Tags.Tasks);
        this.infoText   = GameObject.FindGameObjectWithTag(Resources.Tags.InfoText);
        this.pauseMenu  = GameObject.FindGameObjectWithTag(Resources.Tags.PauseMenu);
        this.pauseMenu.SetActive(false);
        this.repairSlider = GameObject.FindGameObjectWithTag(Resources.Tags.RepairSlider).GetComponent <Slider>();
        this.repairSlider.gameObject.SetActive(false);

        Transform[] baseCommandersSpawnPoints = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.BaseCommanderSpawnPoint), item => item.transform);
        Transform[] commandersSpawnPoints     = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.CommanderSpawnPoint), item => item.transform);
        Transform[] soldiersSpawnPoints       = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.SoldierSpawnPoint), item => item.transform);
        Transform[] workersSpawnPoints        = Array.ConvertAll(GameObject.FindGameObjectsWithTag(Resources.Tags.WorkerSpawnPoint), item => item.transform);
        this.ManageEnemies.SetSpawnPoints(baseCommandersSpawnPoints, commandersSpawnPoints, soldiersSpawnPoints, workersSpawnPoints);

        // load saved game or start new...
        this.ProgressInGame = (GameSaveLoad.LoadSavedGame ? GameSaveLoad.Load() : new GameProgress());

        this.ReadGameProgress(GameSaveLoad.LoadSavedGame);
    }
示例#20
0
    private IEnumerator UnlockSequence()
    {
        while (!this.episodeSelector.IsRotated)
        {
            yield return(null);
        }
        if (base.GetComponent <EpisodeButton>())
        {
            this.episodeSelector.MoveToTarget(base.transform);
        }
        else
        {
            this.episodeSelector.MoveToTarget(base.transform.parent);
        }
        yield return(new WaitForSeconds(0.5f));

        while (!this.episodeSelector.IsRotated)
        {
            yield return(null);
        }
        GameProgress.UnlockButton(this.buttonUnlockKey);
        if (this.buttonLock != null)
        {
            this.buttonLock.NotifyUnlocked();
        }
        yield break;
    }
示例#21
0
    private void OnSceneWasLoaded(Scene scene, LoadSceneMode mode)
    {
        GameObject titleCanvasObj = GameObject.Find("TitleGroup");

        if (titleCanvasObj)
        {
            CanvasGroup titleCanvas = titleCanvasObj.GetComponent <CanvasGroup>();
            titleCanvas.alpha = 0;
            StartCoroutine(RevealCanvas(titleCanvas, 1.5f));
        }

        GameObject startPromptCanvasObj = GameObject.Find("StartPromptGroup");

        if (startPromptCanvasObj)
        {
            CanvasGroup startPromptCanvas = startPromptCanvasObj.GetComponent <CanvasGroup>();
            startPromptCanvas.alpha = 0;
            StartCoroutine(RevealCanvas(startPromptCanvas, 5f));
        }

        // Not the ideal way to do this, but it'll serve for now
        if (titleCanvasObj && startPromptCanvasObj)
        {
            GameProgress.Reset();
            EventBus.PublishEvent(new TitleScreenLoadedEvent());
        }
    }
示例#22
0
    public void LoadLevel(string levelIndex)
    {
        if (this.startedLevelLoading)
        {
            return;
        }
        this.startedLevelLoading = true;
        this.SendStandardFlurryEvent("Select Level", levelIndex);
        int num = int.Parse(levelIndex);

        if (num >= 0)
        {
            if (this.m_oneTimeCutscene.enabled && !GameProgress.GetBool(this.m_oneTimeCutscene.saveId, false, GameProgress.Location.Local, null))
            {
                Singleton <GameManager> .Instance.LoadLevelAfterCutScene(this.m_levels[num], this.m_oneTimeCutscene.cutScene);

                GameProgress.SetBool(this.m_oneTimeCutscene.saveId, true, GameProgress.Location.Local);
            }
            else
            {
                Singleton <GameManager> .Instance.LoadLevel(num);
            }
            return;
        }
        this.startedLevelLoading = false;
    }
 //加载场景时,有的场景需要Loading界面过渡时可以使用这个方法
 public void LoadingToScene(string targetSceneName, GameProgress name)
 {
     needload = true;
     //loading的场景是哪一个
     AsyncLoadScene(targetSceneName, name);
     currentUIManager.loadingUI();
 }
示例#24
0
    private void Start()
    {
        this.maxCount = GameProgress.MaxSkullCount();
        this.m_skull  = base.transform.Find("Skull");
        this.m_skull.localPosition = -Vector3.up * 17f;
        this.m_bgColor             = base.transform.Find("BackgroundBox").GetComponent <Renderer>().material;
        int             num             = 0;
        CollectableType collectableType = this.type;

        if (collectableType != CollectableType.Skull)
        {
            if (collectableType == CollectableType.Statue)
            {
                num = GameProgress.SecretStatueCount();
            }
        }
        else
        {
            num = GameProgress.SecretSkullCount();
        }
        base.transform.Find("Skull/SkullText").GetComponent <TextMesh>().text = ((num >= 10) ? (num + "/" + this.maxCount) : string.Concat(new object[]
        {
            "0",
            num,
            "/",
            this.maxCount
        }));
        base.StartCoroutine(this.PlayAnimation());
    }
示例#25
0
 private void Start()
 {
     Score          = 0;
     Height         = 0;
     pro            = GameProgress.Start;
     Time.timeScale = 0;
 }
示例#26
0
    public void LoadNextLevel()
    {
        EndLevel();

        if (m_currentMapIdx < MapList.Count - 1)
        {
            ++m_currentMapIdx;
        }
        else
        {
            DialogsController.GetInstance().ShowDialog(DialogType.MapSelectorMenu);
            return;
        }

        var mapPahs = MapList.GetMapPaths(m_currentMapIdx);

        if (mapPahs == null)
        {
            return;
        }

        ResetTempMapData();
        MapInfo map_info = (mapPahs.GetMapPrefab()).GetComponent <MapInfo>();

        map_info.m_mapName = mapPahs.Name;
        map_info.m_mapIcon = mapPahs.GetMapIcon();
        GameProgress.SetMap(m_currentMapIdx, false);

        DialogsController.GetInstance().ShowMapDescriptionMenu(m_currentMapIdx);
    }
示例#27
0
 private void Start()
 {
     SetAllLists();
     GameProgress.Load();
     thisTransform = transform;
     Init();
 }
示例#28
0
    private void Awake()
    {
        dorgAI = GetComponent <RobotDogAI>();

        GameProgress.LogObjectivesPickedUp();
        // EventBus.Subscribe<ObjectiveItemPickedUpEvent>(OnObjectiveItemHasBeenPickedUpEvent);
    }
示例#29
0
 private void AddSandboxUnlockDialog(Button button, SandboxUnlockDialog dialog, string levelIdentifier, int price, Func <bool> requirements)
 {
     button.MethodToCall.SetMethod(this, "OpenSandboxUnlockDialog");
     this.onOpenUnlockDialog = delegate()
     {
         dialog.SandboxIdentifier = levelIdentifier;
         dialog.Cost = price;
         dialog.ShowConfirmEnabled = requirements;
         dialog.SetOnConfirm(delegate
         {
             if (!GameProgress.GetSandboxUnlocked(levelIdentifier) && requirements() && GameProgress.UseSnoutCoins(price))
             {
                 GameProgress.SetSandboxUnlocked(levelIdentifier, true);
                 GameProgress.SetButtonUnlockState("SandboxLevelButton_" + levelIdentifier, GameProgress.ButtonUnlockState.Locked);
                 Singleton <GameManager> .Instance.ReloadCurrentLevel(true);
                 this.ReportUnlockSandbox(price, levelIdentifier);
                 EventManager.Connect(new EventManager.OnEvent <LevelLoadedEvent>(this.DelayedPurchaseSound));
             }
             else if (!requirements() && Singleton <IapManager> .IsInstantiated())
             {
                 dialog.Close();
                 Singleton <IapManager> .Instance.OpenShopPage(new Action(dialog.Open), "SnoutCoinShop");
             }
             else
             {
                 dialog.Close();
             }
         });
     };
 }
示例#30
0
 private void Awake()
 {
     gameSuccessController = uiController.GetComponent <GameSuccessController>();
     gameProgress          = new GameProgress();
     cubes = new List <GameObject>();
     spawnObjectsOnPlane = GameObject.FindObjectOfType <SpawnObjectsOnPlane>();
 }
示例#31
0
    private void Start()
    {
        if (GameProgress.GetBool("show_content_limit_popup", false, GameProgress.Location.Local, null))
        {
            GameProgress.DeleteKey("show_content_limit_popup", GameProgress.Location.Local);
            LevelInfo.DisplayContentLimitNotification();
        }
        Transform transform = base.transform.Find("RightButtons/SandboxToggle/SandBox_Toggle(Clone)");

        if (transform != null)
        {
            this.m_buttonToggleAnimation = transform.GetComponent <Animation>();
        }
        if (this.m_buttonToggleAnimation != null)
        {
            AnimationClip clip = this.m_buttonToggleAnimation.GetClip("Sandbox_Toggle");
            if (clip != null)
            {
                this.m_buttonToggleAnimation.clip = clip;
                AnimationState animationState = this.m_buttonToggleAnimation["Sandbox_Toggle"];
                animationState.enabled        = true;
                animationState.speed          = 0f;
                animationState.normalizedTime = ((!this.m_isRotated) ? 0.5f : 1f);
                this.m_buttonToggleAnimation.Play();
                this.m_buttonToggleAnimation.Sample();
                this.m_buttonToggleAnimation.Stop();
            }
        }
    }
        public ProgressScreen(GameProgress gameProgress)
            : base()
        {
            progress = gameProgress;

            components.Add(new Ui.Label(string.Format("Welcome back, {0}!", progress.Name), new Vector2(100, 100), Ui.FontManager.MenuFont, Color.White));
            components.Add(new Ui.Label(string.Format("You are at day {0}.", progress.Day), new Vector2(120, 200), Ui.FontManager.MenuFont, Color.White));
        }
示例#33
0
文件: Player.cs 项目: toyman93/Buzzle
 private Player()
 {
     this.Name = "Player";
     this.Progress = new GameProgress ();
     this.PurchasedItems = new List<BuyableItem> ();
     this.CurrentUsableItem = null;
     this.ProgressDictionary = new Dictionary<string, int> ();
 }
示例#34
0
	public static GameProgress LoadFromDisk() {

		GameProgress gp = new GameProgress();

		gp.bestScore = PlayerPrefs.GetInt( "BestScore", 0 );
		gp.synchronized = PlayerPrefs_GetBool( "Synchronized", true);

		return gp;
	}
示例#35
0
 public void SetPoint(GameProgress.Player player)
 {
     if (player == GameProgress.Player.Player1) {
         gameProgress.player1Score++;
         SetPlayers (GameProgress.Player.Player2);
     }
     if (player == GameProgress.Player.Player2) {
         gameProgress.player2Score++;
         SetPlayers (GameProgress.Player.Player1);
     }
 }
示例#36
0
 public void MergeWith(GameProgress other) {
     // int i;
     // for (i = 0; i < LevelCount; i++) {
     //     if (mProgress[i].MergeWith(other.mProgress[i])) {
     //         mDirty = true;
     //     }
     // }
     // if (other.mPilotExp > mPilotExp) {
     //     mPilotExp = other.mPilotExp;
     //     mDirty = true;
     // }
 }
 public void MergeWith(GameProgress other) {
     int i;
     for (i = 0; i < LevelCount; i++) {
         if (mProgress[i].MergeWith(other.mProgress[i])) {
             mDirty = true;
         }
     }
     if (other.mPilotExp > mPilotExp) {
         mPilotExp = other.mPilotExp;
         mDirty = true;
     }
 }
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);

        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
示例#39
0
	private GameManager() {
		mProgress = GameProgress.LoadFromDisk();

		// Enable/disable logs on the PlayGamesPlatform
		PlayGamesPlatform.DebugLogEnabled = GameConsts.PlayGamesDebugLogsEnabled;
		
		// Activate the Play Games platform. This will make it the default
		// implementation of Social.Active
		PlayGamesPlatform.Activate();
		
		// Set the default leaderboard for the leaderboards UI
		((PlayGamesPlatform) Social.Active).SetDefaultLeaderboardForUI( GameIds.LeaderboardId );

	}
示例#40
0
    public void SetPlayers(GameProgress.Player player)
    {
        switch (player) {
        case GameProgress.Player.Player1 :
            {
                ball.transform.position = ball2Start.transform.position;
                break;
            }
        case GameProgress.Player.Player2:
            {
                ball.transform.position = ball1Start.transform.position;
                break;
            }
        }

        player1.transform.position = player1Start.transform.position;
        player2.transform.position = player2Start.transform.position;
        ball.GetComponent<Rigidbody2D> ().velocity = new Vector3 (0,0,9);
    }
示例#41
0
 // Use this for initialization
 void Start()
 {
     gameProgress = GameProgress.Instance;
 }
示例#42
0
    public static GameProgress Load()
    {
        if (_gameProgress != null) {
            return _gameProgress;
        }
        #if UNITY_WEBPLAYER
            Debug.Log ("Not loading game progress as insode web player");
            _gameProgress = new GameProgress ();
        #else
            _gameProgress = LoadFromFile();
        #endif

        return _gameProgress;
    }
示例#43
0
 private GameManager()
 {
     mProgress = GameProgress.LoadFromDisk();
 }
示例#44
0
	// 
	void OnGUI()
	{
		switch (progress) {
		case GameProgress.Ready:
			// 필드와 기호를 그립니다.
			DrawFieldAndMarks();
			break;

		case GameProgress.Turn:
			// 필드와 기호를 그립니다.
			DrawFieldAndMarks();
			// 남은 시간을 그립니다.
			if (turn == localMark) {
				DrawTime();
			}
			break;
			
		case GameProgress.Result:
			// 필드와 기호를 그립니다.
			DrawFieldAndMarks();
			// 승자를 표시합니다.
			DrawWinner();
			// 종료 버튼을 표시합니다.
			{
				GUISkin skin = GUI.skin;
				GUIStyle style = new GUIStyle(GUI.skin.GetStyle("button"));
				style.normal.textColor = Color.white;
				style.fontSize = 25;

				if (GUI.Button(new Rect(Screen.width/2-100, Screen.height/2, 200, 100), "끝", style)) {
					progress = GameProgress.GameOver;
					step_count = 0.0f;
				}
			}
			break;

		case GameProgress.GameOver:
			// 필드와 기호를 그립니다.
			DrawFieldAndMarks();
			// 승자를 표시합니다.
			DrawWinner();
			break;

		case GameProgress.Disconnect:
			// 필드와 기호를 그립니다.
			DrawFieldAndMarks();
			// 연결 끊김을 통지합니다.
			NotifyDisconnection();
			break;

		default:
			break;
		}

	}
示例#45
0
 public void MergeWith(GameProgress other)
 {
     if (other.mHighestScore > mHighestScore)
     {
         mHighestScore = other.mHighestScore;
         mDirty = true;
     }
     if (other.mLongestDistance > mLongestDistance)
     {
         mLongestDistance = other.mLongestDistance;
         mDirty = true;
     }
     if (other.mTotalScore > mTotalScore)
     {
         mTotalScore = other.mTotalScore;
         mDirty = true;
     }
     if (other.mIslanderExp > mIslanderExp) {
         mIslanderExp = other.mIslanderExp;
         mDirty = true;
     }
 }
示例#46
0
	// 게임 시작.
	public void GameStart()
	{
		// 게임 시작 상태로 합니다.
		progress = GameProgress.Ready;

		// 서버가 먼저 하게 설정합니다.
		turn = Mark.Circle;

		// 자신과 상대의 기호를 설정합니다.
		if (m_transport.IsServer() == true) {
			localMark = Mark.Circle;
			remoteMark = Mark.Cross;
		}
		else {
			localMark = Mark.Cross;
			remoteMark = Mark.Circle;
		}

		// 이전 설정을 클리어합니다.
		isGameOver = false;
	}
示例#47
0
 public static void ResetGameProgress()
 {
     Instance = new GameProgress();
 }
示例#48
0
	// 이벤트 발생 시의 콜백 함수.
	public void EventCallback(NetEventState state)
	{
		switch (state.type) {
		case NetEventType.Disconnect:
			if (progress < GameProgress.Result && isGameOver == false) {
				progress = GameProgress.Disconnect;
			}
			break;
		}
	}
示例#49
0
    ///////////////////////////////////////////////////////////////////////////////
    // functions
    ///////////////////////////////////////////////////////////////////////////////
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    void Awake()
    {
        // ========================================================
        // system setup
        // ========================================================

        Application.targetFrameRate = 60;
        if ( dontDestroy )
            DontDestroyOnLoad(gameObject);

        // ========================================================
        // get cached components
        // ========================================================

        hsController = GetComponent<HSController>();

        // ========================================================
        // load game progress and initialize
        // ========================================================

        gameProgress = GetComponent<GameProgress>();
        if ( gameProgress != null ) {
            gameProgress.LoadPlayerProfile();
            // ApplyPlayerProfile();
        }

        // ========================================================
        // here we will create instance to get the default value and prevent NULL reference
        // ========================================================

        if ( playerProfile == null ) {
            playerProfile = new PlayerProfile();
        }
    }
示例#50
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1; //In case we arrived here from a paused state
        _gameProgress = GameProgress.Load ();

        selectText1.text = _gameProgress.GetLevelName ("level_" + world + "_1");
        selectText2.text = _gameProgress.GetLevelName ("level_" + world + "_2");
        selectText3.text = _gameProgress.GetLevelName ("level_" + world + "_3");
        selectText4.text = _gameProgress.GetLevelName ("level_" + world + "_4");
        selectText5.text = _gameProgress.GetLevelName ("level_" + world + "_5");
        selectText6.text = _gameProgress.GetLevelName ("level_" + world + "_6");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_7");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_8");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_9");
        selectText7.text = _gameProgress.GetLevelName ("level_" + world + "_10");

        AssignMedalSprite (selectMedal1, _gameProgress.GetMedalAttained ("level_" + world + "_1"));
        AssignMedalSprite (selectMedal2, _gameProgress.GetMedalAttained ("level_" + world + "_2"));
        AssignMedalSprite (selectMedal3, _gameProgress.GetMedalAttained ("level_" + world + "_3"));
        AssignMedalSprite (selectMedal4, _gameProgress.GetMedalAttained ("level_" + world + "_4"));
        AssignMedalSprite (selectMedal5, _gameProgress.GetMedalAttained ("level_" + world + "_5"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_6"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_7"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_8"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_9"));
        AssignMedalSprite (selectMedal6, _gameProgress.GetMedalAttained ("level_" + world + "_10"));

        padlock1.enabled = false;

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_1")) {
            selectText2.text = "";
            selectMedal2.enabled = false;
            var navigation = level1Button.navigation;
            navigation.selectOnRight = null;
            level1Button.navigation = navigation;
            level2Button.interactable = false;
            padlock2.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_2")) {
            selectText3.text = "";
            selectMedal3.enabled = false;
            var navigation = level2Button.navigation;
            navigation.selectOnRight = null;
            level2Button.navigation = navigation;
            level3Button.interactable = false;
            padlock3.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_3")) {
            selectText4.text = "";
            selectMedal4.enabled = false;
            var navigation = level3Button.navigation;
            navigation.selectOnRight = null;
            level3Button.navigation = navigation;
            level4Button.interactable = false;
            padlock4.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_4")) {
            selectText5.text = "";
            selectMedal5.enabled = false;
            var navigation = level4Button.navigation;
            navigation.selectOnDown = null;
            level4Button.navigation = navigation;
            level5Button.interactable = false;
            padlock5.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_5")) {
            selectText6.text = "";
            selectMedal6.enabled = false;
            var navigation = level5Button.navigation;
            navigation.selectOnLeft = null;
            level5Button.navigation = navigation;
            level6Button.interactable = false;
            padlock6.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_6")) {
            selectText7.text = "";
            selectMedal7.enabled = false;
            var navigation = level6Button.navigation;
            navigation.selectOnLeft = null;
            level6Button.navigation = navigation;
            level7Button.interactable = false;
            padlock7.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_7")) {
            selectText8.text = "";
            selectMedal8.enabled = false;
            var navigation = level7Button.navigation;
            navigation.selectOnLeft = null;
            level7Button.navigation = navigation;
            level8Button.interactable = false;
            padlock8.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_8")) {
            selectText9.text = "";
            selectMedal9.enabled = false;
            var navigation = level8Button.navigation;
            navigation.selectOnLeft = null;
            level8Button.navigation = navigation;
            level9Button.interactable = false;
            padlock9.enabled = true;
        }

        if (!_gameProgress.GetLevelComplete ("level_" + world + "_9")) {
            selectText10.text = "";
            selectMedal10.enabled = false;
            var navigation = level9Button.navigation;
            navigation.selectOnLeft = null;
            level9Button.navigation = navigation;
            level10Button.interactable = false;
            padlock10.enabled = true;
        }
    }
示例#51
0
 public static GameProgress FromString(string s) {
     GameProgress gp = new GameProgress();
     string[] p = s.Split(new char[] { ':' });
     if (!p[0].Equals("GPv2")) {
         Debug.LogError("Failed to parse game progress from: " + s);
         return gp;
     }
     // gp.mPilotExp = System.Convert.ToInt32(p[1]);
     // int i;
     // for (i = 2; i < p.Length && i - 2 < LevelCount; i++) {
     //     gp.GetLevelProgress(i - 2).SetFromString(p[i]);
     // }
     return gp;
 }
示例#52
0
	// 게임 리셋.
	void Reset()
	{
		//turn = Turn.Own;
		turn = Mark.Circle;
		progress = GameProgress.None;
		
		// 미선택으로 하고 초기화합니다.
		for (int i = 0; i < spaces.Length; ++i) {
			spaces[i] = -1;	
		}
	}
示例#53
0
 public static GameProgress FromString(string s)
 {
     GameProgress gp = new GameProgress();
     string[] p = s.Split(new char[] { ':' });
     if (!p[0].Equals("GPv2")) {
         Debug.LogError("Failed to parse game progress from: " + s);
         return gp;
     }
     gp.mIslanderExp = System.Convert.ToInt32(p[1]);
     gp.mLongestDistance = System.Convert.ToInt64(p[2]);
     gp.mHighestScore = System.Convert.ToInt64(p[3]);
     gp.mTotalScore = System.Convert.ToInt64(p[4]);
     return gp;
 }
示例#54
0
	void UpdateTurn()
	{
		bool setMark = false;

		if (turn == localMark) {
			setMark = DoOwnTurn();

            //둘 수 없는 장소를 누르면 클릭용 사운드효과를 냅니다.
            if (setMark == false && Input.GetMouseButtonDown(0)) {
                AudioSource audio = GetComponent<AudioSource>();
                audio.clip = se_click;
                audio.Play();
            }
		}
		else {
			setMark = DoOppnentTurn();

            //둘 수 없을 때 누르면 클릭용 사운드 효과를 냅니다.
            if (Input.GetMouseButtonDown(0)) {
                AudioSource audio = GetComponent<AudioSource>();
                audio.clip = se_click;
                audio.Play();
            }
		}

		if (setMark == false) {
			// 놓을 곳을 검토 중입니다.	
			return;
		}
        else {
            //기호가 놓이는 사운드 효과를 냅니다. 
            AudioSource audio = GetComponent<AudioSource>();
            audio.clip = se_setMark;
            audio.Play();
        }
		
		// 기호의 나열을 체크합니다.
		winner = CheckInPlacingMarks();
		if (winner != Winner.None) {
            //승리한 경우는 사운드효과를 냅니다.
            if ((winner == Winner.Circle && localMark == Mark.Circle)
                || (winner == Winner.Cross && localMark == Mark.Cross)) {
                AudioSource audio = GetComponent<AudioSource>();
                audio.clip = se_win;
                audio.Play();
            }
            //BGM재생종료.
            GameObject bgm = GameObject.Find("BGM");
            bgm.GetComponent<AudioSource>().Stop();

			// 게임 종료입니다.
			progress = GameProgress.Result;			
		}
		
		// 턴을 갱신합니다.
		turn = (turn == Mark.Circle)? Mark.Cross : Mark.Circle; 
		timer = turnTime;
	}
示例#55
0
 // Use this for initialization
 void Start()
 {
     gameProgress = GameProgress.Instance;
     SetPlayers (GameProgress.Player.Player1);
 }
示例#56
0
	void UpdateReady()
	{
		// 시합 시작 신호 표시를 기다립니다.
		currentTime += Time.deltaTime;

		if (currentTime > waitTime) {
            //BGM 재생 시작.
            GameObject bgm = GameObject.Find("BGM");
            bgm.GetComponent<AudioSource>().Play();

			// 표시가 끝나면 게임 시작입니다.
			progress = GameProgress.Turn;
		}
	}
 private GameManager()
 {
     mProgress = GameProgress.LoadFromDisk();
     mAutoSaveName = "Autosaved";
 }
 public static GameProgress FromString(string s)
 {
     GameProgress gp = new GameProgress();
     string[] p = s.Split(new char[] { ':' });
     if (!p[0].StartsWith("GPv")) {
         Debug.LogError("Failed to parse game progress from: " + s);
         return gp;
     }
     gp.mPilotExp = System.Convert.ToInt32(p[1]);
     int i;
     for (i = 2; i < p.Length && i - 2 < LevelCount; i++) {
         gp.GetLevelProgress(i - 2).SetFromString(p[i]);
     }
     if(p[0].Equals("GPv3")) {
         double val = Double.Parse(p[p.Length -1]);
         gp.mPlayingTime = TimeSpan.FromMilliseconds(val>0f?val:0f);
     } else {
         gp.mPlayingTime = new TimeSpan();
     }
     gp.mLoadedTime = DateTime.Now;
     return gp;
 }