public override void Start()
 {
     base.Start();
     ui_TvAdvertisingHint.text = GameCommonInfo.GetUITextById(101);
     ColorUtility.TryParseHtmlString("#0b752b", out Color outline);
     ui_TvAdvertisingHint.outlineColor = outline;
 }
Example #2
0
    public void OnClickForAddSpeed()
    {
        GameDataHandler gameDataHandler = uiComponent.handler_GameData;
        GameBean        gameData        = uiComponent.handler_Game.GetGameData();
        UserDataBean    userData        = gameDataHandler.GetUserData();
        int             maxLevel        = uiComponent.handler_GameData.GetLevelMaxForSpeed();

        gameDataHandler.GetLevelLevelUpDataForSpeed(gameData.levelForSpeed, out float addSpeed, out long preSpeedGold);
        if (!gameData.HasEnoughGold(preSpeedGold))
        {
            //钱不够
            uiComponent.manager_Msg.ShowMsg(GameCommonInfo.GetUITextById(1001));
            return;
        }

        bool isLevelUp = gameData.LevelUpForPlayerSpeed(maxLevel, addSpeed);

        if (!isLevelUp)
        {
            //升级失败
            uiComponent.manager_Msg.ShowMsg(GameCommonInfo.GetUITextById(1002));
            return;
        }

        //支付金币
        gameData.PayGold(preSpeedGold);

        uiComponent.handler_Character.SetCharacterSpeed(CharacterTypeEnum.Player, gameData.GetPlayerSpeed() + userData.speed);
        uiComponent.handler_Character.RefreshCharacter(CharacterTypeEnum.Player);
        RefreshUI();
    }
Example #3
0
    public void OnClickForAddGoldPrice()
    {
        UserDataBean    userData        = uiComponent.handler_GameData.GetUserData();
        GameDataHandler gameDataHandler = uiComponent.handler_GameData;
        GameBean        gameData        = uiComponent.handler_Game.GetGameData();

        int maxLevel = uiComponent.handler_GameData.GetLevelMaxForGoldPrice();

        gameDataHandler.GetLevelUpDataForGoldPrice(gameData.levelForGoldPrice, out int addPrice, out long prePriceGold);
        if (!gameData.HasEnoughGold(prePriceGold))
        {
            //钱不够
            uiComponent.manager_Msg.ShowMsg(GameCommonInfo.GetUITextById(1001));
            return;
        }

        bool isLevelUp = gameData.LevelUpForGoldPrice(maxLevel, addPrice);

        if (!isLevelUp)
        {
            //升级失败
            uiComponent.manager_Msg.ShowMsg(GameCommonInfo.GetUITextById(1002));
            return;
        }

        //支付金币
        gameData.PayGold(prePriceGold);

        RefreshUI();
    }
Example #4
0
    public override void Awake()
    {
        base.Awake();
        if (ui_PvLevelUp)
        {
            ui_PvLevelUp.SetCompleteContent(GameCommonInfo.GetUITextById(4));
            ui_PvLevelUp.SetContentOutline(new Color(0, 0, 0, 0.4f), 0.2f);
        }

        if (ui_BtLevelUp)
        {
            ui_BtLevelUp.onClick.AddListener(OnClickForLevelUp);
        }
    }
Example #5
0
    private void Start()
    {
        if (ui_BtSpeedAdd)
        {
            ui_BtSpeedAdd.onClick.AddListener(OnClickForAddSpeed);
        }
        if (ui_BtNumberAdd)
        {
            ui_BtNumberAdd.onClick.AddListener(OnClickForAddNumber);
        }
        if (ui_BtGoldPriceAdd)
        {
            ui_BtGoldPriceAdd.onClick.AddListener(OnClickForAddGoldPrice);
        }
        if (ui_BtDamageAdd)
        {
            ui_BtDamageAdd.onClick.AddListener(OnClickForAddDamage);
        }


        if (ui_TvTitleGoldPrice)
        {
            ui_TvTitleGoldPrice.outlineColor = Color.white;
            ui_TvTitleGoldPrice.text         = GameCommonInfo.GetUITextById(1);
            SetUnderlayOffsetY(ui_TvTitleGoldPrice);
        }
        if (ui_TvTitleSpeed)
        {
            ui_TvTitleSpeed.outlineColor = Color.white;
            ui_TvTitleSpeed.text         = GameCommonInfo.GetUITextById(2);
            SetUnderlayOffsetY(ui_TvTitleSpeed);
        }

        if (ui_TvTitleNumber)
        {
            ui_TvTitleNumber.outlineColor = Color.white;
            ui_TvTitleNumber.text         = GameCommonInfo.GetUITextById(3);
            SetUnderlayOffsetY(ui_TvTitleNumber);
        }
        RefreshUI();
    }
Example #6
0
    public void OnClickForAddNumber()
    {
        GameBean        gameData        = uiComponent.handler_Game.GetGameData();
        GameDataHandler gameDataHandler = uiComponent.handler_GameData;
        UserDataBean    userData        = gameDataHandler.GetUserData();

        int maxLevel = uiComponent.handler_GameData.GetLevelMaxForNumber();

        gameDataHandler.GetLevelLevelUpDataForNumber(gameData.levelForPirateNumber, out int addNumber, out long preNumberGold);

        if (!gameData.HasEnoughGold(preNumberGold))
        {
            //钱不够
            uiComponent.manager_Msg.ShowMsg(GameCommonInfo.GetUITextById(1001));
            return;
        }
        bool isLevelUp = gameData.LevelUpForPlayerPirateNumber(maxLevel, addNumber);

        if (!isLevelUp)
        {
            //升级失败
            uiComponent.manager_Msg.ShowMsg(GameCommonInfo.GetUITextById(1002));
            return;
        }
        //支付金币
        gameData.PayGold(preNumberGold);
        //生成海盗
        for (int i = 0; i < addNumber; i++)
        {
            CharacterDataBean playerCharacterData = new CharacterDataBean(CharacterTypeEnum.Player)
            {
                life      = userData.life + gameData.playerForLife,
                maxLife   = userData.life + gameData.playerForLife,
                moveSpeed = userData.speed + gameData.GetPlayerSpeed()
            };
            uiComponent.handler_Character.CreateCharacter(playerCharacterData);
        }
        RefreshUI();
    }