Ejemplo n.º 1
0
    protected override void OnActive(bool active)
    {
        if (active)
        {
            for (int i = 0; i < data.Length; i++)
            {
                data[i].btn.onSelect = OnSelect;
                data[i].btn.onClick  = OnClick;
            }

            back.onClick = OnBack;

            UICamera.selectedObject = data[startIndex].btn.gameObject;
            infoLabel.text          = GameLocalize.GetText(data[startIndex].infoRef);
            NGUILayoutBase.RefreshNow(transform);
        }
        else
        {
            for (int i = 0; i < data.Length; i++)
            {
                data[i].btn.onSelect = null;
                data[i].btn.onClick  = null;
            }

            back.onClick = null;
        }
    }
Ejemplo n.º 2
0
    void ResetData()
    {
        mMoveState           = MoveState.None;
        rotateTrans.rotation = Quaternion.identity;

        LevelManager lvlMgr = LevelManager.instance;

        planetPrev.Play(lvlMgr.prevStageData.planetRef);
        planetCur.Play(lvlMgr.curStageData.planetRef);
        planetNext.Play(lvlMgr.nextStageData.planetRef);

        planetPrev.Sprite.color = lvlMgr.prevStageData.unlocked ? Color.white : lockedColor;
        planetCur.Sprite.color  = lvlMgr.curStageData.unlocked ? Color.white : lockedColor;
        planetNext.Sprite.color = lvlMgr.nextStageData.unlocked ? Color.white : lockedColor;

        title.text  = lvlMgr.curStageData.title;
        title.color = lvlMgr.curStageData.unlocked ? Color.white : lockedColor;

        if (lvlMgr.curStageData.unlocked)
        {
            desc.text = lvlMgr.curStageData.desc;
        }
        else
        {
            desc.text = string.Format(GameLocalize.GetText("stage_locked"), lvlMgr.curStageData.starRequire);
        }

        //desc.color = lvlMgr.curStageData.unlocked ? Color.white : lockedColor;

        NGUILayoutBase.RefreshNow(transform);
    }
Ejemplo n.º 3
0
    void OnNewGame(GameObject go)
    {
        if (PlayerStats.isGameExists)
        {
            UIModalConfirm.Open(
                GameLocalize.GetText("newgame_confirm_title"),
                GameLocalize.GetText("newgame_confirm_desc"),
                delegate(bool yes) {
                if (yes)
                {
                    Debug.Log("clearing save");
                    SceneState.instance.ClearAllSavedData();
                    UserData.instance.Save();

                    PlayerStats.isGameExists = true;
                    Main.instance.sceneManager.LoadScene(Scenes.levelSelect);
                }
            });
        }
        else
        {
            PlayerStats.isGameExists = true;
            Main.instance.sceneManager.LoadScene(Scenes.levelSelect);
        }
    }
Ejemplo n.º 4
0
    public override void Apply(bool isLocalized, string text, string aName = null, string portraitSpriteRef = null, string[] choices = null)
    {
        nameLabel.text      = isLocalized ? GameLocalize.GetText(aName) : aName;
        textLabel.text      = isLocalized ? GameLocalize.GetText(text) : text;
        portrait.spriteName = portraitSpriteRef;
        portrait.MakePixelPerfect();

        mDoLayoutUpdate = true;
    }
Ejemplo n.º 5
0
 void OnExitToMainMenuClick(GameObject go)
 {
     UIModalConfirm.Open(GameLocalize.GetText("exit_to_main_title"), GameLocalize.GetText("exit_confirm_desc"),
                         delegate(bool yes) {
         if (yes)
         {
             Main.instance.sceneManager.LoadScene(Scenes.main);
         }
     });
 }
Ejemplo n.º 6
0
    protected override void OnOpen()
    {
        //initialize data based on current stage selected
        ResetData();

        hiScoreLabel.text = string.Format(GameLocalize.GetText("hiscore"), LevelManager.instance.totalScore);
        starMaxLabel.text = string.Format(GameLocalize.GetText("maxstars"), LevelManager.instance.totalStars);

        NGUILayoutBase.RefreshLate(topTrans);
    }
Ejemplo n.º 7
0
 void OnSelect(GameObject go, bool state)
 {
     if (state)
     {
         int ind = GetIndex(go);
         if (ind != -1)
         {
             infoLabel.text = GameLocalize.GetText(data[ind].infoRef);
             NGUILayoutBase.RefreshNow(transform);
         }
     }
 }
Ejemplo n.º 8
0
    protected override void OnOpen()
    {
        if (!string.IsNullOrEmpty(sWeaponTitleRef))
        {
            title.text = GameLocalize.GetText(sWeaponTitleRef);
            desc.text  = GameLocalize.GetText(sWeaponTitleRef + "_desc");
        }
        if (!string.IsNullOrEmpty(sWeaponIconRef))
        {
            icon.spriteName = sWeaponIconRef;
        }

        NGUILayoutBase.RefreshNow(transform);
    }
Ejemplo n.º 9
0
    void OnExitClick(GameObject go)
    {
        if (mInputLockCounter > 0)
        {
            return;
        }

        UIModalConfirm.Open(
            GameLocalize.GetText("exit_confirm_title"), GameLocalize.GetText("exit_confirm_desc"),
            delegate(bool yes) {
            if (yes)
            {
                Main.instance.sceneManager.LoadScene(Scenes.levelSelect);
            }
        });
    }
Ejemplo n.º 10
0
 void OnInput(InputManager.Info dat)
 {
     if (!UIModalManager.instance.ModalIsInStack(UIModalConfirm.modalName))
     {
         if (dat.state == InputManager.State.Pressed)
         {
             UIModalConfirm.Open(GameLocalize.GetText("skip_confirm_title"), GameLocalize.GetText("skip_confirm_desc"),
                                 delegate(bool yes) {
                 if (yes)
                 {
                     Main.instance.input.RemoveButtonCall(0, InputAction.MenuEscape, OnInput);
                     Player.instance.state = (int)EntityState.Final;
                 }
             });
         }
     }
 }
Ejemplo n.º 11
0
    public void RefreshClearTime()
    {
        string text = SlotInfo.GetClearTimeString(UserSlotData.currentSlot);

        label.text = string.Format(GameLocalize.GetText("cleartime"), text);

        if (SlotInfo.HasClearTime(UserSlotData.currentSlot))
        {
            if (SlotInfo.gameMode == SlotInfo.GameMode.Hardcore)
            {
                Leaderboard.instance.PostScore("Clear Time Iron Maiden", text, Mathf.RoundToInt(SlotInfo.GetClearTime(UserSlotData.currentSlot) * 1000.0f));
            }
            else if (SlotInfo.gameMode == SlotInfo.GameMode.Normal)
            {
                Leaderboard.instance.PostScore("Clear Time", text, Mathf.RoundToInt(SlotInfo.GetClearTime(UserSlotData.currentSlot) * 1000.0f));
            }
        }
    }
Ejemplo n.º 12
0
    void OnEnable()
    {
        int modeInd = (int)SlotInfo.gameMode;

        mode.text  = GameLocalize.GetText(gameModes[modeInd].textRef);
        mode.color = gameModes[modeInd].color;

        armor.color = SlotInfo.isArmorAcquired ? Color.white : Color.black;

        //get hp mod counts
        heartsFoundLabel.text = string.Format("{0}/{1}", SlotInfo.heartCount, SlotInfo.hpModMaxCount);

        livesLabel.text = SlotInfo.gameMode == SlotInfo.GameMode.Hardcore ? string.Format("x{0:D2}", PlayerStats.curLife >= 0 ? PlayerStats.curLife - 1 : 0) : "--";

        //get sub energy counts
        int subECount = 0;

        if (SlotInfo.isSubTankEnergy1Acquired)
        {
            subECount++;
        }
        if (SlotInfo.isSubTankEnergy2Acquired)
        {
            subECount++;
        }

        subEnergyTanksFoundLabel.text = string.Format("{0}/{1}", subECount, 2);

        //get sub weapon counts
        int subWCount = 0;

        if (SlotInfo.isSubTankWeapon1Acquired)
        {
            subWCount++;
        }
        if (SlotInfo.isSubTankWeapon2Acquired)
        {
            subWCount++;
        }

        subWeaponTanksFoundLabel.text = string.Format("{0}/{1}", subWCount, 2);
    }
Ejemplo n.º 13
0
    void OnInput(InputManager.Info dat)
    {
        if (!UIModalManager.instance.ModalIsInStack(UIModalConfirm.modalName))
        {
            if (dat.state == InputManager.State.Pressed)
            {
                UIModalConfirm.Open(GameLocalize.GetText("skip_confirm_title"), GameLocalize.GetText("skip_confirm_desc"),
                                    delegate(bool yes) {
                    if (yes)
                    {
                        for (int i = 0; i < InputAction._count; i++)
                        {
                            Main.instance.input.RemoveButtonCall(0, i, OnInput);
                        }

                        Main.instance.sceneManager.LoadScene(toScene);
                    }
                });
            }
        }
    }
Ejemplo n.º 14
0
    void OnDeleteClick(GameObject go)
    {
        int slot = GetSlot(go);

        if (slot != -1)
        {
            mLateRefresh = true;

            mSelectedSlot = slot;

            UIModalConfirm.Open(GameLocalize.GetText("delete_confirm_title"), GameLocalize.GetText("delete_confirm_desc"),
                                delegate(bool yes) {
                if (yes)
                {
                    SlotInfo.DeleteData(slot);
                    UserSlotData.DeleteSlot(slot);
                    PlayerPrefs.Save();
                }
            });
        }
    }
Ejemplo n.º 15
0
    void OnInfoClick(GameObject go)
    {
        int slot = GetSlot(go);

        if (slot != -1)
        {
            mSelectedSlot = slot;

            if (SlotInfo.IsDead(slot))
            {
                UIModalConfirm.Open(GameLocalize.GetText("dead_confirm_title"), GameLocalize.GetText("dead_confirm_desc"),
                                    delegate(bool yes) {
                    if (yes)
                    {
                        SlotInfo.DeleteData(slot);
                        UserSlotData.DeleteSlot(slot);

                        SlotInfo.CreateSlot(ModalSaveSlots.selectedSlot, SlotInfo.GameMode.Hardcore);
                        SceneState.instance.ResetGlobalValues();
                        SceneState.instance.ResetValues();
                        AchievementFixRetroActive();
                        Main.instance.sceneManager.LoadScene(Scenes.levelSelect);
                    }
                });
            }
            else
            {
                UserSlotData.LoadSlot(slot, true);
                SlotInfo.LoadCurrentSlotData();
                SceneState.instance.ResetGlobalValues();
                SceneState.instance.ResetValues();
                AchievementFixRetroActive();
                Main.instance.sceneManager.LoadScene(Scenes.levelSelect);
            }
        }
    }
Ejemplo n.º 16
0
    /// <summary>
    /// Force pickup
    /// </summary>
    public void PickUp(Player player)
    {
        if (player && player.state != (int)EntityState.Dead && player.state != (int)EntityState.Invalid && gameObject.activeInHierarchy)
        {
            float val = value;

            switch (type)
            {
            case ItemType.Health:
                if (player.stats.curHP < player.stats.maxHP)
                {
                    if (player.stats.curHP + val > player.stats.maxHP)
                    {
                        player.stats.subTankEnergyCurrent += (player.stats.curHP + val) - player.stats.maxHP;
                    }

                    player.stats.curHP += val;
                }
                else
                {
                    player.stats.subTankEnergyCurrent += val;

                    //TODO: play special sound?
                }
                break;

            case ItemType.Energy:
                Weapon wpn = null;
                if (player.currentWeaponIndex == 0)
                {
                    wpn = player.lowestEnergyWeapon;
                }
                else
                {
                    wpn = player.currentWeapon;
                }

                if (wpn && !wpn.isMaxEnergy)
                {
                    if (wpn.currentEnergy + val > Weapon.weaponEnergyDefaultMax)
                    {
                        player.stats.subTankWeaponCurrent += (wpn.currentEnergy + val) - Weapon.weaponEnergyDefaultMax;
                    }

                    wpn.currentEnergy += val;
                }
                else
                {
                    player.stats.subTankWeaponCurrent += val;

                    //TODO: play special sound?
                }
                break;

            case ItemType.Life:
                PlayerStats.curLife++;
                HUD.instance.RefreshLifeCount();
                break;

            case ItemType.HealthUpgrade:
                PlayerStats.AddHPMod(bit);
                break;

            case ItemType.EnergyTank:
                if (bit == 0)
                {
                    player.stats.AcquireSubTankEnergy1();
                }
                else
                {
                    player.stats.AcquireSubTankEnergy2();
                }
                break;

            case ItemType.WeaponTank:
                if (bit == 0)
                {
                    player.stats.AcquireSubTankWeapon1();
                }
                else
                {
                    player.stats.AcquireSubTankWeapon2();
                }
                break;

            case ItemType.Armor:
                player.stats.AcquireArmor();
                break;
            }

            if (!string.IsNullOrEmpty(sound))
            {
                SoundPlayerGlobal.instance.Play(sound);
            }

            if (collider)
            {
                collider.enabled = false;
            }

            if (!string.IsNullOrEmpty(popTextRef))
            {
                HUD.instance.PopUpMessage(GameLocalize.GetText(popTextRef));
            }

            Release();
        }
    }
Ejemplo n.º 17
0
    /// <summary>
    /// Force pickup
    /// </summary>
    public void PickUp(Player player)
    {
        if(player && player.state != (int)EntityState.Dead && player.state != (int)EntityState.Invalid && gameObject.activeInHierarchy) {
            float val = value;

            switch(type) {
                case ItemType.Health:
                    if(player.stats.curHP < player.stats.maxHP) {
                        if(player.stats.curHP + val > player.stats.maxHP) {
                            player.stats.subTankEnergyCurrent += (player.stats.curHP + val) - player.stats.maxHP;
                        }

                        player.stats.curHP += val;
                    }
                    else {
                        float curTankAmt = player.stats.subTankEnergyCurrent;
                        player.stats.subTankEnergyCurrent += val;

                        if(curTankAmt < player.stats.subTankEnergyCurrent)
                            SoundPlayerGlobal.instance.Play(sfxId);
                    }
                    break;

                case ItemType.Energy:
                    Weapon wpn = null;
                    if(player.currentWeaponIndex == 0 || player.currentWeapon.isMaxEnergy) {
                        wpn = player.lowestEnergyWeapon;
                    }
                    else
                        wpn = player.currentWeapon;

                    if(wpn && !wpn.isMaxEnergy) {
                        if(wpn.currentEnergy + val > Weapon.weaponEnergyDefaultMax) {
                            player.stats.subTankWeaponCurrent += (wpn.currentEnergy + val) - Weapon.weaponEnergyDefaultMax;
                        }

                        wpn.currentEnergy += val;

                        if(wpn != player.currentWeapon)
                            SoundPlayerGlobal.instance.Play(sfxId);
                    }
                    else {
                        float curTankAmt = player.stats.subTankWeaponCurrent;
                        player.stats.subTankWeaponCurrent += val;

                        if(curTankAmt < player.stats.subTankWeaponCurrent)
                            SoundPlayerGlobal.instance.Play(sfxId);
                    }
                    break;

                case ItemType.Life:
                    PlayerStats.curLife++;
                    HUD.instance.RefreshLifeCount();
                    SoundPlayerGlobal.instance.Play(sfxId);
                    break;

                case ItemType.HealthUpgrade:
                    SlotInfo.AddHPMod(bit);
                    Player.instance.stats.RefreshHPMod();
                    SoundPlayerGlobal.instance.Play(sfxId);
                    break;

                case ItemType.EnergyTank:
                    if(bit == 0)
                        player.stats.AcquireSubTankEnergy1();
                    else
                        player.stats.AcquireSubTankEnergy2();

                    SoundPlayerGlobal.instance.Play(sfxId);
                    break;

                case ItemType.WeaponTank:
                    if(bit == 0)
                        player.stats.AcquireSubTankWeapon1();
                    else
                        player.stats.AcquireSubTankWeapon2();

                    SoundPlayerGlobal.instance.Play(sfxId);
                    break;

                case ItemType.Armor:
                    player.stats.AcquireArmor();
                    player.RefreshArmor();

                    SoundPlayerGlobal.instance.Play(sfxId);
                    break;

                case ItemType.Invul:
                    player.stats.invulGO.SetActive(true);
                    break;
            }

            if(savePickUp) {
                SceneState.instance.SetGlobalFlag(LevelController.levelPickupBitState, pickupBit, true, false);

                bool isHardcore = SlotInfo.gameMode == SlotInfo.GameMode.Hardcore;
                if(isHardcore) {
                    int dat = SceneState.instance.GetGlobalValue(LevelController.levelPickupBitState, 0);
                    SceneState.instance.SetValue(LevelController.levelPickupBitState, dat, true);
                }
            }

            if(!string.IsNullOrEmpty(sound)) {
                SoundPlayerGlobal.instance.Play(sound);
            }

            if(collider)
                collider.enabled = false;

            if(pickupCallback != null)
                pickupCallback(this);

            if(dialogTextRefs != null && dialogTextRefs.Length > 0) {
                mCurDialogTextInd = 0;
                UIModalCharacterDialog dlg = UIModalCharacterDialog.Open(true, UIModalCharacterDialog.defaultModalRef,
                                                                         dialogTextRefs[mCurDialogTextInd], HUD.gitgirlNameRef, HUD.gitgirlPortraitRef, null);
                dlg.actionCallback += OnDialogAction;

            }
            else {
                if(!string.IsNullOrEmpty(popTextRef))
                    HUD.instance.PopUpMessage(GameLocalize.GetText(popTextRef));

                Release();
            }
        }
    }