Example #1
0
 public BattleSystem(GameSystem gameSystem, Canvas canvas)
 {
     this.gameSystem = gameSystem;
     battlePanel     = canvas.GetComponent <BattlePanel>();
     turnSystem      = new TurnSystem(battlePanel);
     canvas.enabled  = false;
     isBattle        = false;
 }
Example #2
0
 protected virtual void Client_OnZoneLeaved(DeepMMO.Client.Battle.RPGBattleClient obj)
 {
     this.SuspendLayout();
     if (BattlePanel != null)
     {
         this.panel1.Controls.Remove(this.BattlePanel);
         BattlePanel.Dispose();
         BattlePanel = null;
     }
     this.ResumeLayout(false);
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        render  = GetComponent <SpriteRenderer>();
        cardImg = transform.GetChild(0).GetComponent <SpriteRenderer>();
        hpText  = transform.Find("Blood").GetChild(0).GetComponent <TextMesh>();
        strText = transform.Find("Str").GetChild(0).GetComponent <TextMesh>();
        panel   = transform.parent.GetComponent <BattlePanel>();
        raceImg = transform.Find("Race").GetComponent <SpriteRenderer>();

        MessageCenter.Instance.Subscribe("MatchCellInfo.HpLeft", Id, hpText.gameObject, hp => hpText.text = hp.ToString());
        MessageCenter.Instance.Subscribe("MatchCellInfo.Str", Id, strText.gameObject, str => strText.text = str.ToString());
    }
Example #4
0
    /// <summary>
    ///  处理计算伤害的响应
    /// </summary>
    /// <param name="response"></param>
    public override void OnOperationResponse(OperationResponse response)
    {
        DtoDamage[] damages = JsonMapper.ToObject <DtoDamage[]>(response[(byte)ParameterCode.DtoDamages] as string);
        DtoDamage   item    = null;

        for (int i = 0; i < damages.Length; i++)
        {
            item = damages[i];
            if (item == null)
            {
                continue;
            }

            int toId = item.ToId;
            // 获取目标控制器
            AIBaseCtrl toCtrl = BattleData.Instance.CtrlDict.ExTryGet(toId);
            if (toCtrl == null)
            {
                return;
            }

            toCtrl.Model.CurHp -= item.Damage;
            toCtrl.OnHpChange();

            // 显示伤害数值
            BattlePanel panel = UIManager.Instance.GetPanel(UIPanelType.Battle) as BattlePanel;
            panel.FloatDamage(item.Damage, toCtrl.transform);

            // 如果被攻击的是自己
            if (toId == GameData.HeroData.Id)
            {
                GameData.HeroData = toCtrl.Model as DtoHero;
                // 更新ui界面
                panel.UpdateView();
                if (item.IsDead)
                {
                    // 开始复活倒计时
                    (UIManager.Instance.GetPanel(UIPanelType.Battle) as BattlePanel).StartRebirthCD();
                    // 遮罩
                    UIManager.Instance.ShopPanel(UIPanelType.Mask);
                    toCtrl.DeathResponse();
                }
            }
            else
            {
                // 如果目标死亡了
                if (item.IsDead)
                {
                    toCtrl.DeathResponse();
                }
            }
        }
    }
Example #5
0
 public void StartBattle()
 {
     if (totalHpPlayer >= totalHpEnemy)
     {
         StartCoroutine(AddFightingText(totalHpEnemy, "Player Won"));
         targetpos.GetComponent <VillageInfo>().Level_info._isBattleWin = true;
     }
     else
     {
         StartCoroutine(AddFightingText(totalHpPlayer, "Enemy Won"));
     }
     BattlePanel.SetActive(false);
 }
Example #6
0
 protected virtual void Client_OnZoneChanged(DeepMMO.Client.Battle.RPGBattleClient obj)
 {
     this.SuspendLayout();
     if (BattlePanel != null)
     {
         this.panel1.Controls.Remove(this.BattlePanel);
         BattlePanel.Dispose();
         BattlePanel = null;
     }
     this.BattlePanel      = new GamePanel(this, obj);
     this.BattlePanel.Dock = DockStyle.Fill;
     this.BattlePanel.BattleView.OnDrawHUD += BattleView_OnDrawHUD;
     this.BattlePanel.BattleView.AutoUpdateBattleClient = this.AutoUpdateBattleClient;
     this.ResumeLayout(false);
     this.panel1.Controls.Add(BattlePanel);
 }
    public void ChangePanels(BattlePanel targetPanel)
    {
        //Hide the old panel
        if (currentPanel != null)
        {
            currentPanel.Hide();
        }

        //Show the new panel
        currentPanel = targetPanel;

        if (currentPanel != null)
        {
            currentPanel.Show();
        }
    }
Example #8
0
    IEnumerator moveto(Vector2 target)
    {
        float Step = speed * Time.deltaTime;

        while (Vector2.Distance(Player.transform.position, target) > 0.2f)
        {
            Player.transform.position = Vector2.MoveTowards(Player.transform.position, target, Step);
            CurrentDay           = GetDay.EnterDayCode(Mathf.RoundToInt(Vector2.Distance(Player.transform.position, target)));
            currentTimezone.text = CurrentDay;
            yield return(null);
        }

        _buttonDown = false;
        for (int i = 0; i < BattleSlider.Count; i++)
        {
            BattleSlider[i].value         = 0;
            BattleSliderUpperText[i].text = "0";
        }
        BattleLOGtxt.text                = "";
        Total_Calcaulation_txt.text      = "0";
        Total_ATk_Calucation_txt.text    = "0";
        Total_CalcaulationEnemy_Hp.text  = "200";
        Total_CalcaulationEnemy_ATK.text = "100";
        totalHpEnemy   = 200;
        totalATKEnemy  = 100;
        totalHpPlayer  = 0;
        totalATKPlayer = 0;


        if (targetpos.GetComponent <VillageInfo>().Level_info._isBattleWin)
        {
            OpenCity();
        }
        else
        {
            OkPanel.SetActive(false);
            BattlePanel.SetActive(true);
            MainMenuPanel.SetActive(true);
            BattleMenuPanel.SetActive(true);
            UpgradeMenuPanel.SetActive(false);
        }


        updateDbEnd(-temp_EnduranceRequiredValue);
    }
Example #9
0
    //Show results of battle
    public void ShowBattlePanel(string description, int defenderRoll_1, int attackerRoll_1,
                                int defenderRoll_2, int attackerRoll_2, int defenderRoll_3, int attackerRoll_3, string winLoss)
    {
        attackPanel.SetActive(false);
        _Map.SetActive(false);
        battalionsPanel.SetActive(false);
        Menu.SetActive(false);
        //Disable Attack Phase Gui
        attackPhasePanel.SetActive(false);
        battlePanel.SetActive(true);

        BattlePanel battle = battlePanel.GetComponent <BattlePanel>();

        battle.descriptionText.text   = description;
        battle.defenderRoll1Text.text = defenderRoll_1.ToString();
        battle.attackerRoll1Text.text = attackerRoll_1.ToString();
        battle.defenderRoll2Text.text = defenderRoll_2.ToString();
        battle.attackerRoll2Text.text = attackerRoll_2.ToString();
        battle.defenderRoll3Text.text = defenderRoll_3.ToString();
        battle.attackerRoll3Text.text = attackerRoll_3.ToString();
        battle.winLossText.text       = winLoss;
        print("Battle Panel Active!");
    }
    public override void Init(params object[] args)
    {
        base.Init(args);
        singleEnemy = args[0] as SingleExamEnemy;
        parentPanel = args[1] as BattlePanel;


        startBattle = false;


        if (singleEnemy != null)
        {
            pro = singleEnemy.Property;
        }
        else
        {
            pro = RoleManager.Instance.playerPeople.protoData.PropertyData;
        }
        float proNumSpeed = BattleManager.Instance.GetCurExamPropertyById(PropertyIdType.Speed, pro).PropertyNum;

        curAttackTime = (1 / (BattleManager.Instance.GetCurExamPropertyById(PropertyIdType.Speed, pro).PropertyNum)) * parentPanel.basicAttackSpeed;
        Show();
        //txt_hp.SetText(propertyData.exam)
    }
Example #11
0
 // Use this for initialization
 void Awake()
 {
     _enemyButton = GetComponent<Button>();
     _enemyBattleStats = GetComponentInChildren<BattlePanel>();
 }
Example #12
0
 public Player(string name) : base(name)
 {
     magicSkills = new List <Spell> ();
     special     = new SpecialSkill(stats, 0f, new List <Spell>(), "");
     battlePanel = gameSystem.battleCanvas.GetComponent <BattlePanel>();
 }
Example #13
0
 void Awake()
 {
     _playerButton = GetComponent<Button>();
     _actionBar = GetComponentInChildren<ActionBar>();
     _playerBattleStats = GetComponentInChildren<BattlePanel>();
 }
Example #14
0
 public TurnSystem(BattlePanel battlePanel)
 {
     this.battlePanel = battlePanel;
 }
Example #15
0
    //void OnChangedHeroParam(PropertyInfo property)
    //{
    //    return;
    //}

    /// <summary> 배치된 지역 보여주기 </summary>
    public void ShowDeployedPlace()
    {
        if (state == HeroSlotState.Territory && string.IsNullOrEmpty(heroData.placeID) == false)
        {
            string placeName = heroData.placeID;
            if (GameDataManager.productionLineBaseDataDic.ContainsKey(heroData.placeID))
            {
                placeName = GameDataManager.productionLineBaseDataDic[heroData.placeID].name;
            }
            else if (GameDataManager.placeBaseDataDic.ContainsKey(heroData.placeID))
            {
                placeName = GameDataManager.placeBaseDataDic[heroData.placeID].name;
            }


            Text text = BattlePanel.GetComponentInChildren <Text>();
            text.text = placeName;
            BattlePanel.SetActive(true);
        }
        else if (state == HeroSlotState.Battle && HeroManager.heroDataDic[id].heroType == HeroData.HeroType.Battle)
        {
            if (heroData != null && string.IsNullOrEmpty(heroData.battleGroupID) == false)
            {
                //HeroData data = HeroManager.heroDataDic[id];
                string dungeonName = GameDataManager.dungeonBaseDataDic[Battle.battleGroupList.Find(x => x.battleType == heroData.battleGroupID).dungeonID].dungeonName;
                Text   text        = BattlePanel.GetComponentInChildren <Text>();
                text.text = dungeonName;
                BattlePanel.SetActive(true);
            }
            else
            {
                BattlePanel.SetActive(false);
            }
        }
        else if (state == HeroSlotState.Training)
        {
            if (string.IsNullOrEmpty(heroData.placeID) == false)
            {
                string placeName = heroData.placeID;
                if (GameDataManager.productionLineBaseDataDic.ContainsKey(heroData.placeID))
                {
                    placeName = GameDataManager.productionLineBaseDataDic[heroData.placeID].name;
                }
                else if (GameDataManager.placeBaseDataDic.ContainsKey(heroData.placeID))
                {
                    placeName = GameDataManager.placeBaseDataDic[heroData.placeID].name;
                }


                Text text = BattlePanel.GetComponentInChildren <Text>();
                text.text = placeName;
                BattlePanel.SetActive(true);
            }
            else if (HeroManager.heroDataDic[id].heroType == HeroData.HeroType.Battle)
            {
                if (heroData != null && string.IsNullOrEmpty(heroData.battleGroupID) == false)
                {
                    string dungeonName = GameDataManager.dungeonBaseDataDic[Battle.battleGroupList.Find(x => x.battleType == heroData.battleGroupID).dungeonID].dungeonName;
                    Text   text        = BattlePanel.GetComponentInChildren <Text>();
                    text.text = dungeonName;
                    BattlePanel.SetActive(true);
                }
                else
                {
                    BattlePanel.SetActive(false);
                }
            }
            else
            {
                BattlePanel.SetActive(false);
            }
        }
        else
        {
            BattlePanel.SetActive(false);
        }
    }
Example #16
0
 public Minimap(BattlePanel mainView)
 {
     this.battleView  = mainView;
     this.allMiniMaps = new Dictionary <NPCView, RectTransform>();
 }