Example #1
0
    public void UpdateShow()
    {
        PlayerInfomation info = PlayerInfomation.instance;

        diamondLabel.text = info.Diamond + "";
        coinLabel.text    = info.Coin + "";
    }
Example #2
0
    public void OnPlayerHpChange(int hp_now)  //血量改变时候调用
    {
        PlayerInfomation info = PlayerInfomation.instance;

        hpLabel.text = hp_now + "/" + info.Hp;
        hpBar.value  = (float)hp_now / info.Hp;
    }
 void Awake()
 {
     instance              = this;
     OnPlayerInfoChanged  += OnPlayerInfoChange; //注意将方法名字写对,该委托用于同步更新到服务器
     roleController        = GetComponent <RoleController>();
     inventoryDBController = GetComponent <InventoryDBController>();
 }
    public void CardSetting(List <byte> cardlist, PlayerInfomation info)
    {
        MyInfo = info;
        GameManager.instance.MainPlayerSetting(info);

        if (cardlist.Count <= CardList.Count)
        {
            for (int i = 0; i < CardList.Count; i++)
            {
                if (i < cardlist.Count)
                {
                    CardList[i].CardObj.SetActive(true);
                    CardList[i].CardNumSetting(cardlist[i]);
                }
                else
                {
                    CardList[i].CardObj.SetActive(false);
                }
            }
        }
        else
        {
            // 만약 더미카드숫자보다 받아온 카드리스트의 숫자가 더 많을때 나타나는 에러
            Debug.LogError("List Count Not Match!!");
        }

        CurrentCardCount = cardlist.Count;

        SelectCardReset();
    }
Example #5
0
    public void OnUpgradeBtnClick()
    {
        int coin              = (skill.Level + 1) * 500; //下一级所需金币
        int level             = skill.Level;             //当前技能等级
        PlayerInfomation info = PlayerInfomation.instance;

        if (info.Level <= level)
        {
            MessageManager.instance.ShowMessage("等级不足");
            return;
        }
        bool isSuccess = PlayerInfomation.instance.CostCoin(coin);

        if (isSuccess)  //金币足够
        {
            skill.Upgrade();
            if (skill.Level == 2)  //第一次升级
            {
                SkillManager.instance.SkillUpgrade(skill);
            }
            else
            {
                SkillManager.instance.SkillUpgrade(skill, false);
            }
            UpdateShow();
        }
        else
        {
            MessageManager.instance.ShowMessage("金币不足");
        }
    }
Example #6
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.F1))  //测试用,满血复活
     {
         TranscriptManager.instance.player.GetComponent <PlayerAttack>().Hp();
         PlayerInfomation info = PlayerInfomation.instance;
         hpLabel.text = info.Hp + "/" + info.Hp;
         hpBar.value  = info.Hp / info.Hp;
     }
 }
Example #7
0
    // Player 정보 초기화
    public void InitPlayerInformation()
    {
        player              = new PlayerInfomation();
        player.MAX_HP       = 100;
        player.player_HP    = player.MAX_HP;
        player.player_Score = 0;
        player.player_Point = 0;
        player.BulletPower  = 20;

        this.SetHPBar();
        this.SetScoreView();
    }
Example #8
0
    public void UpdateShow()
    {
        PlayerInfomation info = PlayerInfomation.instance;

        nameLabel.text        = info.Name;
        headSprite.spriteName = info.Head;
        levelLabel.text       = "Lv." + info.Level;
        energyLabel.text      = info.Energy + "/100";
        energyBar.value       = info.Energy / 100f;
        toughenLabel.text     = info.Toughen + "/50";
        toughenBar.value      = info.Toughen / 50f;
    }
Example #9
0
    public void UpdateShow()
    {
        PlayerInfomation info = PlayerInfomation.instance;

        nameLabel.text        = info.Name;
        headSprite.spriteName = info.Head;
        levelLabel.text       = "Lv." + info.Level;
        hpLabel.text          = info.Hp + "/" + info.Hp;
        hpBar.value           = info.Hp / info.Hp;
        energyLabel.text      = info.Energy + "/100";
        energyBar.value       = info.Energy / 100f;
    }
Example #10
0
    public Skill GetSkillByPosition(PosType posType)
    {
        PlayerInfomation info = PlayerInfomation.instance;

        foreach (Skill skill in skillList)
        {
            if (skill.MType == info.MType && skill.PosType == posType)  //返回的技能唯一
            {
                return(skill);
            }
        }
        return(null);
    }
Example #11
0
    public void OnItemBtnClick(TranscriptItem transcript)  //点击地下城按钮
    {
        PlayerInfomation info = PlayerInfomation.instance;

        if (info.Level >= transcript.levelNeed)  //人物等级大于地下城等级,可以进入
        {
            currentTranscript = transcript;
            TranscriptDialog.instance.ShowDialog(transcript);
        }
        else  //等级不足,警告
        {
            TranscriptDialog.instance.ShowWarn();
        }
    }
    public void UpdateShow()
    {
        PlayerInfomation info = PlayerInfomation.instance;

        helmEquip.SetItem(info._mHelm);
        clothEquip.SetItem(info._mCloth);
        weaponEquip.SetItem(info._mWeapon);
        shoesEquip.SetItem(info._mShoes);
        necklaceEquip.SetItem(info._mNecklace);
        braceletEquip.SetItem(info._mBracelet);
        ringEquip.SetItem(info._mRing);
        wingEquip.SetItem(info._mWing);

        hpLabel.text     = info.Hp + "";
        damageLabel.text = info.Damage + "";
        expLabel.text    = info.Exp + "/" + GameController.ExpByLevel(info.Level + 1);
        expBar.value     = (float)info.Exp / GameController.ExpByLevel(info.Level + 1);
    }
Example #13
0
    public void UpdateShow()
    {
        PlayerInfomation info = PlayerInfomation.instance;

        nameLabel.text        = info.Name;
        headSprite.spriteName = info.Head;
        levelLabel.text       = info.Level + "";
        powerLabel.text       = info.Power + "";
        int expNext = GameController.ExpByLevel(info.Level + 1);  //升到下一等级所需经验

        expLabel.text = info.Exp + "/" + expNext;
        expBar.value  = (float)info.Exp / expNext;

        diamondLabel.text = info.Diamond + "";
        coinLabel.text    = info.Coin + "";

        energyLabel.text  = info.Energy + "/100";
        toughenLabel.text = info.Toughen + "/50";
    }
Example #14
0
    public void UpdateTimeShow()
    {
        PlayerInfomation info = PlayerInfomation.instance;

        if (info.Energy >= 100)
        {
            energy_partLabel.text = "00:00:00";
            energy_allLabel.text  = "00:00:00";
        }
        else
        {
            int    seconds     = 60 - (int)info.energy_timer;
            string str_seconds = seconds < 10 ? "0" + seconds : seconds + "";  //小于10的时候显示09,08,07...大于10的时候显示12,11,10...
            energy_partLabel.text = "00:00:" + str_seconds;

            int minutes = (99 - info.Energy);
            int hours   = minutes / 60;
            minutes %= 60;
            string str_minutes = minutes < 10 ? "0" + minutes : minutes + "";
            string str_hours   = hours < 10 ? "0" + hours : hours + "";
            energy_allLabel.text = str_hours + ":" + str_minutes + ":" + str_seconds;
        }

        if (info.Toughen >= 50)
        {
            toughen_partLabel.text = "00:00:00";
            toughen_allLabel.text  = "00:00:00";
        }
        else
        {
            int    seconds     = 60 - (int)info.toughen_timer;
            string str_seconds = seconds < 10 ? "0" + seconds : seconds + "";  //小于10的时候显示09,08,07...大于10的时候显示12,11,10...
            toughen_partLabel.text = "00:00:" + str_seconds;

            int minutes = (49 - info.Toughen);
            int hours   = minutes / 60;
            minutes %= 60;
            string str_minutes = minutes < 10 ? "0" + minutes : minutes + "";
            string str_hours   = hours < 10 ? "0" + hours : hours + "";
            toughen_allLabel.text = str_hours + ":" + str_minutes + ":" + str_seconds;
        }
    }