示例#1
0
    public void CopyBattleStageData(StageInfo _info)
    {
        LogManager.LogToFile("start copy chapter ...");
        BattleStage pNewData = new BattleStage();

        pNewData.m_BattlePieceNum = _info.id;
        pNewData.m_StarSum        = _info.starsum;
        pNewData.m_bRewardGot     = _info.rewardgot;

        foreach (StageBattle item in _info.stagebattles)
        {
            StageData pData = new StageData();
            pData.m_StageID      = item.id;
            pData.m_StageStar    = item.maxstar;
            pData.m_FightSum     = item.fightnum;
            pData.m_BuyBattleNum = item.buybattlenum;
            //if (pData.m_FightSum == 0)
            //{
            //    // 是否已经查看
            //    if (mViewList.ContainsKey(pData.m_StageID))
            //    {
            //        // 插入未开启列表
            //        mViewList.Add(pData.m_StageID, true);
            //    }
            //}

            pNewData.m_BattleStage.Add(pData);
        }
        if (_info.id != 1001)
        {
            ObjectSelf.GetInstance().SetCurChapterID(_info.id);
        }
        m_BattleStageList.Add(_info.id, pNewData);
    }
示例#2
0
    public override void OnStartDragging(float x, float y)
    {
        if (currentSelAvatar != null)
        {
            currentSelAvatar.Color = MapAvatar.ColorDefault;
            currentSelAvatar       = null;
        }

        WorldPos2MapPos(x, y, out float gx, out float gy);
        var avatar = BattleStage.GetAvatarAt((int)gx, (int)gy);

        if (avatar == null || avatar.Warrior.Team != Room.PlayerMe)
        {
            base.OnStartDragging(x, y);
            return;
        }

        // 显示指针,并隐藏准备拖拽的对象
        currentSelAvatar = avatar;
        PointerIndicator.SetActive(true);
        PointerIndicator.GetComponent <PoniterIndicator>().SetIdleAnimation(currentSelAvatar);
        PointerIndicator.transform.position = currentSelAvatar.transform.position;
        dragPointerOffset = new Vector2(PointerIndicator.transform.position.x - x, PointerIndicator.transform.position.y - y);
        currentSelAvatar.gameObject.SetActive(false);
    }
示例#3
0
    // “开始战斗”事件处理
    private void startBattle(BattleStage stage)
    {
        //Debug.Log("GameManager : Deal with startBattle");
        // 取消所有监听
        sendMessage_DisRegister();

        // 清理内存
        Transform uiRoot = GameObject.Find("UI Root").transform;

        //Debug.Log(uiRoot.FindChild("Panel_Top_Information(Clone)") == null);
        Destroy(uiRoot.FindChild("Panel_Top_Information(Clone)").gameObject);
        //Destroy(GameObject.Find("Panel_Top_Information"));
        Destroy(GameObject.Find("Panel_Bottom(Clone)").gameObject);
        Resources.UnloadUnusedAssets();

        // 保留一个关卡信息对象
        GameObject go = new GameObject("BattleStage Information");
        //go.AddComponent<BattleStage>();
        BattleStageObj battleStageObj = go.AddComponent <BattleStageObj>();

        battleStageObj.battleStage = stage;
        //BattleStage.copy(stage, battleStageObj.battleStage);
        GameObject.DontDestroyOnLoad(go);

        //Debug.Log("Application.LoadLevel : Scenes/InBattle");
        Application.LoadLevel(1);
    }
示例#4
0
    //Battle

    IEnumerator beginBattle()
    {
        _bm._gm._GUI.getBattleGUIElements(this);
        _bm._gm._GUI.hideGenericBattleUI();
        calculateTurns();

        for (int i = 0; i < enemyCount - 1; i++)
        {
            enemies [i].actor.GetComponent <Actor> ().prepForBattle(this);
        }
        partyDown = 0;
        enemyDown = 0;
        turnCount = 0;

        if (_bm._gm._GUI.fadeStatus)
        {
            _bm._gm._GUI.applyFadeIn(4);
            do
            {
                yield return(new WaitForSeconds(Time.deltaTime));
            } while (_bm._gm._GUI.fadeStatus == true);
        }
        turnOwner    = turns.Peek();
        infoBox.text = getTurnOwner().GetComponent <Actor>()._base.name + "'s turn!";
        Debug.Log("Turn owner is " + turnOwner.name);
        battleStage = BattleStage.TURN_DECIDING;

        _bm._gm._GUI.showGenericBattleUI();
        turnManagement();
    }
示例#5
0
 //Called when command is confirmed, action has executed and turn changed
 public void switchNextStage()
 {
     if (battleStage == BattleStage.TURN_DECIDING)
     {
         battleStage = BattleStage.TURN_EXECUTING;
         Debug.Log("Action for turn now being executed!");
         return;
     }
     else if (battleStage == BattleStage.TURN_EXECUTING)
     {
         battleStage = BattleStage.CHANGING_TURN;
         if (!isEnemy(turnOwner))
         {
             StopCoroutine("WaitForPlayerTurn");
         }
         turnStage = TurnStage.TURN_SET;
         Debug.Log("Switching to next actor!");
         turnManagement();
     }
     else if (battleStage == BattleStage.CHANGING_TURN)
     {
         battleStage = BattleStage.TURN_DECIDING;
         turnManagement();
     }
 }
示例#6
0
 // 修改为生存模式
 public void sendMessage_ChangeToLiveMode(BattleStage battleStage)
 {
     if (changeToLiveMode != null)
     {
         changeToLiveMode(battleStage);
     }
 }
示例#7
0
    // 建立一个样板关卡
    public BattleStage[] createSampleBattleMapStages()
    {
        BattleStage[] stages = new BattleStage[6];
        BattleStage   s;

        for (int i = 0; i < 6; i++)
        {
            s              = new BattleStage();
            stages[i]      = s;
            s.level1       = 1;
            s.level2       = i + 1;
            s.consumePower = 2;
            s.stageName    = "测试关卡 " + 1 + "-" + (i + 1);
            s.information  = "尽情的屠杀吧!";
            s.goal         = "杀死所有敌人";
            s.iconPath     = "AdminIcon";
            s.profits      = new GoodsItem[2];
            s.profits[0]   = new GoodsItem("Rifle", "025_6");
            s.profits[1]   = new GoodsItem("Rifle", "018_17");
        }
        stages[0].position = new Vector3(-250, -37, 3);
        stages[1].position = new Vector3(-227, 50, 3);
        stages[2].position = new Vector3(-126, 21, 3);
        stages[3].position = new Vector3(11, -29, 3);
        stages[4].position = new Vector3(109, 34, 3);
        stages[5].position = new Vector3(270, 13, 3);
        return(stages);
    }
示例#8
0
    public override void OnClicked(float x, float y)
    {
        WorldPos2MapPos(x, y, out float gx, out float gy);
        var avatar = BattleStage.GetAvatarAt((int)gx, (int)gy);

        if (currentSelAvatar == null && avatar != null && avatar.Warrior.Team == Room.PlayerMe)
        {
            // 选中要移动的角色
            currentSelAvatar        = avatar;
            avatar.IsShowClickFrame = true;
        }
        else if (currentSelAvatar != null)
        {
            // 交换角色位置
            var mapTile = BattleStage.GetMapTileAt((int)gx, (int)gy);
            currentSelAvatar.IsShowClickFrame = false;
            if (mapTile != null && mapTile.MapData.RespawnForChamp == false)
            {
                currentSelAvatar = null;
                return;
            }
            Room.DoExchangeWarroirsPosition(currentSelAvatar.X, currentSelAvatar.Y, (int)gx, (int)gy);
            currentSelAvatar = null;
        }
    }
示例#9
0
 // 发送开始战斗关卡事件
 public void sendMessage_StartBattleStage(BattleStage battleStage)
 {
     //Debug.Log("Send Message : Start Game");
     if (startBattle != null)
     {
         startBattle(battleStage);
     }
 }
示例#10
0
    // 修改为“生存”模式
    private void changeToLiveMode(BattleStage battleStage)
    {
        Transform t = transform.FindChild("Battle_Ready").FindChild("Mode");

        t.FindChild("Break").GetComponent <UISprite>().spriteName = "ButtonUp_mip_0";
        t.FindChild("Live").GetComponent <UISprite>().spriteName  = "ButtonDown_mip_0";

        battleStage.mode = BattleStage.Mode.Live;
    }
示例#11
0
 /// <summary>
 /// 重置
 /// </summary>
 public void ToReset()
 {
     playerExtraDamage = 0;
     enemyExtraDamage  = 0;
     GameOver          = false;
     battleSatge       = BattleStage.None;
     CurHandCardCount  = 0;
     canDorp           = false;
 }
示例#12
0
 /// <summary>
 /// 前往下个回合阶段
 /// </summary>
 public void NextStage()
 {
     battleSatge++;
     if ((int)battleSatge >= stageCount)
     {
         battleSatge = (BattleStage)1;
     }
     EventManager.Instance.GotoNewStageEvent(battleSatge);
 }
示例#13
0
    public List <StageData> GetStageDataListByChapterId(int chapterId)
    {
        BattleStage bs = GetBattleStageByChapterId(chapterId);

        if (bs != null)
        {
            return(bs.m_BattleStage);
        }

        return(null);
    }
示例#14
0
    IEnumerator FireSkillAniAt(ActiveSkill skill, int x, int y)
    {
        var avatar            = BattleStage.GetAvatarByWarrior(skill.Owner);
        var MapAvatar         = avatar.gameObject.transform.Find("_MapWarrior");
        var skeletonAnimation = MapAvatar.GetComponent <SkeletonAnimation>();

        skeletonAnimation.AnimationState.SetAnimation(0, "skill", false);
        yield return(new WaitForSeconds(2.0f));

        skeletonAnimation.AnimationState.SetAnimation(0, "idle", true);
    }
示例#15
0
 // 清除攻击范围显示
 public void RemoveShowAttackRange()
 {
     FC.For(pathATKRange.Count, (i) =>
     {
         var avatar = BattleStage.GetAvatarAt(pathATKRange[i].X, pathATKRange[i].Y);
         if (avatar != null && avatar.AttackHint.activeSelf)
         {
             avatar.AttackHint.SetActive(false);
         }
     });
     BattleStage.RemoveTile(pathATKRange);
 }
示例#16
0
    public void Init()
    {
        ReadConfig();
        battleSatge = BattleStage.None;
        stageCount  = System.Enum.GetNames(battleSatge.GetType()).Length;
        LoadAsset();

        luaEnv.DoString("require 'GameManager'");

        EventManager.Instance.SceneChangeEvent += ToReset;
        Debug.Log("GameM Init Finished!");
    }
示例#17
0
    /// <summary>
    /// 返回指定章节内的某一关卡是否已经通过 。并输出该关卡通过后的星级数据。未通过返回false 星级-1;
    /// </summary>
    /// <param name="_pieceNum">章节</param>
    /// <param name="stagetID">关卡ID</param>
    /// <param name="_StageStar">输出星级数</param>
    /// <returns></returns>
    public bool IsCopyScenePass(int _pieceNum, int stagetID, out int _StageStar)
    {
        _StageStar = -1;
        if (m_BattleStageList.ContainsKey(_pieceNum) == false)
        {
            _StageStar = -1;
            return(false);
        }

        BattleStage pData = m_BattleStageList[_pieceNum];

        return(pData.IsAlreadyPassStage(stagetID, out _StageStar));
    }
示例#18
0
 // 清除范围显示
 public void RemoveShowRange()
 {
     BattleStage.RemoveTile(Range);
     BattleStage.Map.ForeachObjs((x, y, obj) =>
     {
         if (obj is Warrior)
         {
             var avatar = BattleStage.GetAvatarByWarrior(obj as Warrior);
             avatar.FriendSkillDec.SetActive(false);
             avatar.EnemySkillDec.SetActive(false);
         }
     });
 }
示例#19
0
 public void CreateStage()
 {
     battleStage = CompornentUtility.FindCompornentOnScene <BattleStage>();
     for (int x = 0; x < map.GetLength(0); x++)
     {
         for (int y = 0; y < map.GetLength(1); y++)
         {
             int        mapType    = map[x, y];
             int        mapHeight  = heightmap[x, y];
             GameObject blockPre   = GetPreBlock(mapType);
             Point2     blockPoint = new Point2(x, y);
             CreateBlock(blockPre, blockPoint, mapHeight);
         }
     }
 }
示例#20
0
 public static void copy(BattleStage from, BattleStage to)
 {
     if (to.image != null)
     {
         to.image.spriteName = from.iconPath;
     }
     to.position     = from.position;
     to.level1       = from.level1;
     to.level2       = from.level2;
     to.stageName    = from.stageName;
     to.information  = from.information;
     to.goal         = from.goal;
     to.iconPath     = from.iconPath;
     to.profits      = from.profits;
     to.consumePower = from.consumePower;
 }
示例#21
0
    public void executeSkill()
    {
        if (!isEnemy(turnOwner))
        {
            StopCoroutine("WaitForPlayerTurn");
            _bm._gm._GUI.hideActionMenu();
        }
        getTurnOwner().GetComponent <Actor>()._base.curMana -= curSkill.cost;
        if (!isEnemy(getTurnOwner()))
        {
            _bm._gm._GUI.updatePartyValues();
        }

        battleStage  = BattleStage.TURN_EXECUTING;
        turnStage    = TurnStage.AUTOMATION;
        finalTargets = getMarkedActors();
        curSkill.useSkill(this);
    }
示例#22
0
    // 发送点击战斗关卡事件
    public void sendMessage_ClickBattleStage(BattleStage battleStage)
    {
        //Debug.Log("sendMessage_ClickBattleStage ");

        if (!battleMapReceiveMessage)
        {
            return;
        }

        // 停止“战斗关卡地图”发送消息
        battleMapReceiveMessage = false;

        //Debug.Log("BattleStage " + (battleStage.GetComponent<BattleStage>() == null ? "==" : "!=") + " null");
        if (clickStage != null)
        {
            clickStage(battleStage);
        }
    }
示例#23
0
    // 返回选择的位置
    public override void OnClicked(float x, float y)
    {
        WorldPos2MapPos(x, y, out float gx, out float gy);

        // 检查是否在技能范围内
        if (CheckRange((int)gx, (int)gy, Range))
        {
            RemoveShowRange();
            BattleStage.InBattleOps.RemoveShowAttackRange();
            onSelPos((int)gx, (int)gy);
            BattleStage.StartSkillStage(false);
        }
        else
        {
            // 否则恢复初始状态
            RemoveShowRange();
            BattleStage.StartSkillStage(false);
        }
    }
示例#24
0
    IEnumerator FireSkillAni(ActiveSkill skill)
    {
        var avatar            = BattleStage.GetAvatarByWarrior(skill.Owner);
        var MapAvatar         = avatar.gameObject.transform.Find("_MapWarrior");
        var skeletonAnimation = MapAvatar.GetComponent <SkeletonAnimation>();

        skeletonAnimation.AnimationState.SetAnimation(0, "skill", false);
        yield return(new WaitForSeconds(2.0f));

        // 如果是变身技能需要重新载入Idle动画
        if (skill.Owner is ITransformable)
        {
            avatar.SetIdleAnimation(skill.Owner);
        }
        else
        {
            skeletonAnimation.AnimationState.SetAnimation(0, "idle", true);
        }
    }
示例#25
0
    /// <summary>
    /// 没有三星通关-----扫荡前提;
    /// </summary>
    /// <returns></returns>
    public bool RefreshStateInfo()
    {
        bool        result = true;
        ObjectSelf  obj    = ObjectSelf.GetInstance();
        BattleStage stage  = null;

        if (obj.GetIsPrompt())
        {
            stage = obj.BattleStageData.m_BattleStageList[1001];
        }
        else
        {
            stage = obj.BattleStageData.m_BattleStageList[obj.GetCurChapterID()];
        }
        StageData stageData = stage.GetStageData(obj.CurStageID);

        result = stageData == null || stageData.m_StageStar < 3;

        return(result);
    }
示例#26
0
        private async Task DoResetDataAsync(bool forceResetCharacters)
        {
            //Remove all existing entries.
            if (_context.GlobalData.Any())
            {
                await _context.GlobalData.DeleteFromQueryAsync();
            }

            var newData = new GlobalData
            {
                SeasonName = GlobalData.SeasonName,
                StartTime  = GlobalData.StartTime,
                EndTime    = GlobalData.EndTime,
            };

            _context.GlobalData.Add(newData);

            if (ResetCharacters || forceResetCharacters)
            {
                await _context.Characters.DeleteFromQueryAsync();
                await ImportCharacters();
            }

            var stageText = string.IsNullOrWhiteSpace(StageText) ? "1" : StageText;
            var stages    = stageText.Split(',');

            for (int i = 0; i < stages.Length; ++i)
            {
                var stage = new BattleStage
                {
                    GlobalData = newData,
                    Order      = i,
                    Name       = $"第{_longNameNumbers[i]}阶段",
                    ShortName  = new string((char)('A' + i), 1),
                    StartLap   = int.Parse(stages[i]) - 1,
                };
                _context.BattleStages.Add(stage);
            }

            await _context.SaveChangesAsync();
        }
示例#27
0
    /// <summary>
    /// 刷新小关卡数据
    /// </summary>
    /// <param name="_pieceNum">章节id</param>
    /// <param name="pData"></param>
    public void UpdateSmallBattleStage(int _pieceNum, StageBattle pData)
    {
        if (m_BattleStageList.ContainsKey(_pieceNum) == false)
        {
            //开启新章节的关卡数据 [4/7/2015 Zmy]
            BattleStage pNewData = new BattleStage();
            pNewData.m_BattlePieceNum = _pieceNum;
            pNewData.m_StarSum        = 0;
            pNewData.m_bRewardGot     = 0;

            StageData pNew = new StageData();
            pNew.m_StageID      = pData.id;
            pNew.m_StageStar    = pData.maxstar;
            pNew.m_FightSum     = pData.fightnum;
            pNew.m_BuyBattleNum = pData.buybattlenum;
            pNewData.m_BattleStage.Add(pNew);
            m_BattleStageList.Add(_pieceNum, pNewData);


            if (pNew.m_FightSum == 0)
            {
                mViewList.Add(pNew.m_StageID, true);
                // 更新到数据
                ConfigsManager.Inst.updateNewStages(mViewList);
            }
        }
        else
        {
            BattleStage BattleData = m_BattleStageList[_pieceNum];
            if (BattleData.UpdateBattleStageData(pData))
            {
                if (mViewList.ContainsKey(pData.id) == false)
                {
                    mViewList.Add(pData.id, true);
                }
                // 更新到数据
                ConfigsManager.Inst.updateNewStages(mViewList);
            }
        }
    }
示例#28
0
    public override void OnEndDragging(float fx, float fy, float tx, float ty)
    {
        WorldPos2MapPos(fx, fy, out float gfx, out float gfy);
        WorldPos2MapPos(tx, ty, out float gtx, out float gty);
        var mapTile = BattleStage.GetMapTileAt((int)gtx, (int)gty);

        if (currentSelAvatar == null)
        {
            return;
        }

        // 隐藏指针,执行交换操作,并显示被拖拽对象
        PointerIndicator.SetActive(false);
        currentSelAvatar.gameObject.SetActive(true);
        currentSelAvatar.IsShowClickFrame = false;
        currentSelAvatar = null;

        if (mapTile != null && mapTile.MapData.RespawnForChamp == false)
        {
            return;
        }
        Room.DoExchangeWarroirsPosition((int)gfx, (int)gfy, (int)gtx, (int)gty);
    }
示例#29
0
 public void UpdateBigBattleStage(int _piece, int _starSum, byte _reward)
 {
     if (m_BattleStageList.ContainsKey(_piece) == false)
     {
         //开启新章节的关卡数据 [4/7/2015 Zmy]
         BattleStage pNewData = new BattleStage();
         pNewData.m_BattlePieceNum = _piece;
         pNewData.m_StarSum        = _starSum;
         pNewData.m_bRewardGot     = _reward;
         if (_piece != 1001)
         {
             ObjectSelf.GetInstance().SetCurChapterID(_piece);
         }
         m_BattleStageList.Add(_piece, pNewData);
         ObjectSelf.GetInstance().SetIsFight(false);
         ObjectSelf.GetInstance().SetIsNewMap(true);
     }
     else
     {
         BattleStage BattleData = m_BattleStageList[_piece];
         BattleData.m_StarSum    = _starSum;
         BattleData.m_bRewardGot = _reward;
     }
 }
示例#30
0
    //Manages the active battle
    public void manageBattle()
    {
        _bm._gm._GUI.getBattleGUIElements(this);

        calculateTurns();

        for (int i = 0; i < enemyCount - 1; i++)
        {
            enemies[i].actor.GetComponent <Actor>().prepForBattle(this);
        }

        partyDown    = 0;
        enemyDown    = 0;
        turnCount    = 0;
        turnOwner    = turns.Peek();
        infoBox.text = getTurnOwner().GetComponent <Actor>()._base.name + "'s turn!";
        Debug.Log("Turn owner is " + turnOwner.name);
        battleStage = BattleStage.TURN_DECIDING;

        turnManagement();

        //For skills, when particle effect is fading away get all the particles into an array,
        //lower their alpha over time and eventually when alpha is near zero, disable and delete
    }
 internal protected BattlePhase(BattleStage rpOwner)
 {
     Stage = rpOwner;
 }
示例#32
0
    void UpdateIdle()
    {
        if (m_hpPercentage <= secondStateHPPercent && m_hpPercentage > thirdStateHPPercent)
        {
            curStage = BattleStage.SECOND;
        }
        else if(m_hpPercentage <= thirdStateHPPercent)
        {
            curStage = BattleStage.THIRD;
            AudioManager.Inst.FadeMusic(AudioManager.Inst.s_rumble);
        }

        if(prevStates.Count >= 1)
        {
            if(curStage == BattleStage.FIRST)
            {
                ChooseNextState1();
            }
            else if (curStage == BattleStage.SECOND)
            {
                ChooseNextState2();
            }
            else
            {
                ChooseNextState3();
            }
        }
        else
        {
            curState = State.INTRO;
        }
    }