コード例 #1
0
    /// <summary>
    /// Changes the team member. 更改队伍类型
    /// </summary>
    public void ChangeTeamMember(BaseHttpRequest request, BaseResponse response, MonsterManager monManager)
    {
        if (request != null && response != null && monManager != null)
        {
            ChangeTeamMemberResponse resp = response as ChangeTeamMemberResponse;

            if (resp != null && resp.data)
            {
                if (request.baseType == BaseHttpRequestType.Common_Http_Request)
                {
                    HttpRequest req = request as HttpRequest;
                    if (req != null)
                    {
                        ChangeTeamMemberParam param = req.ParamMem as ChangeTeamMemberParam;
                        if (param != null)
                        {
                            //获取编队
                            MonsterTeam team = RTData.getTeam(param.tmid);
                            //获取宠物
                            Monster mon = monManager.getMonsterById(param.droleid);
                            if (team != null && mon != null)
                            {
                                team.setMember(mon, param.pos - 1);
                            }
                            else if (team != null)
                            {                             //如果不换上新宠物的话
                                team.removeMember(param.pos - 1);
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
    public void freshTeamItems(MonsterTeam team)
    {
        currentTeam = team;
        int count = team.capacity - 3;

//		RED.Log("==============="+count);
        fMaxEulerAngles = count > 0?count * (-45f):0;
        for (int i = 0; i < lstAvatars.Count; i++)
        {
            if (i < szHeadViews.Count)
            {
                Monster mt = team.getMember(i);
                szHeadViews[i].curMonster = mt;
                if (mt == null)
                {
                    if (i == team.capacity)
                    {
                        szHeadViews[i].charatorNeedUnLock(true);
                    }
                    else
                    {
                        szHeadViews[i].charatorNeedUnLock(false);
                    }
                }
            }
        }
    }
コード例 #3
0
ファイル: WukongFate.cs プロジェクト: mengtest/DragonBallNew
    //小悟空的缘分好了
    public bool WukongJump(MonsterTeam Team)
    {
        bool jump = false;

        if (userMgr.UserConfig.wukongfate == 0)
        {
            Monster monWukong = null;
            foreach (Monster mon in Team.TeamMember)
            {
                if (mon != null && mon.num == Wukong)
                {
                    monWukong = mon;
                    break;
                }
            }

            if (monWukong != null)
            {
                bool allFated = Team.IsAllFataActive(monWukong);

                jump = allFated;
                if (jump)
                {
                    userMgr.UserConfig.wukongfate = 1;
                    userMgr.save();
                }
            }
        }

        return(jump);
    }
コード例 #4
0
ファイル: FateManager.cs プロジェクト: mengtest/DragonBallNew
    public void GetMonsterTeam()
    {
        MonsterTeam     tAtkTeam = Core.Data.playerManager.RTData.GetTeam(1);
        MonsterTeam     tDefTeam = Core.Data.playerManager.RTData.GetTeam(2);
        List <FateData> atkFate  = new List <FateData> ();
        List <FateData> defFata  = new List <FateData> ();

        for (int i = 0; i < 7; i++)
        {
            Monster tM = tAtkTeam.getMember(i);
            if (tM != null)
            {
                List <FateData> tAFate = tM.getMyFate(Core.Data.fateManager);
                atkFate.AddRange(tAFate);
            }
        }

        if (tDefTeam != null)
        {
            for (int i = 0; i < 7; i++)
            {
                Monster tM = tDefTeam.getMember(i);
                if (tM != null)
                {
                    List <FateData> tDFate = tM.getMyFate(Core.Data.fateManager);
                    defFata.AddRange(tDFate);
                }
            }
        }

        //defTeamData = Core.Data.playerManager.RTData.GetTeam (2);
    }
コード例 #5
0
 //创建队伍装备数据
 private void setEquipment(EquipTeam[] equipTeam, EquipManager equipManger)
 {
     if (equipTeam != null)
     {
         foreach (EquipTeam et in equipTeam)
         {
             if (et != null)
             {
                 MonsterTeam team = RTData.getTeam(et.id);
                 if (team != null && et.EquipIdList != null)
                 {
                     int length = et.EquipIdList.Count;
                     for (int memberPos = 0; memberPos < length; ++memberPos)
                     {
                         if (et.EquipIdList[memberPos] != null)
                         {
                             foreach (int eqId in et.EquipIdList[memberPos])
                             {
                                 team.setEquip(equipManger.getEquipment(eqId), memberPos);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #6
0
    public void Init(MonsterTeam newTeamId)
    {
        //MonsterTeam[] T_enemies = JsonSave.LoadMonsterTeam ();
        //monsterTeam = T_enemies [newTeamId];
        for (int i = 0; i < this.monstersGO.Length; i++)
        {
            this.monstersGO [i].SetActive(false);
        }

        monsterTeam = newTeamId;

        for (int i = 0; i < monsterTeam.group.Length; i++)
        {
            this.monstersGO [i].SetActive(true);

            SummonerData enemyTemp = new SummonerData();

            for (int j = 0; j < CampaignManager.L_Enemies.Count; j++)
            {
                if (CampaignManager.L_Enemies [j].id == monsterTeam.group [i])
                {
                    enemyTemp = CampaignManager.L_Enemies [j];
                }
            }

            this.monstersGO [i].transform.GetChild(0).GetComponent <Image> ().sprite = Resources.Load <Sprite> ("character_avatars/" + enemyTemp.idAvatar);
        }

        this.rewardText.text     = monsterTeam.goldReward.ToString();
        this.soulRewardText.text = monsterTeam.soulReward.ToString();
    }
コード例 #7
0
		protected internal static BattleFighter createMonsterFighterFromBattleProp(MonsterTeam monsterTeam, FighterInfo fighterProps)
		{
			BattleFighter _fighter = createBattleFighterFromBattleProp(monsterTeam, fighterProps);
			MonsterSkillManager = _fighter;
			FighterBuffManager = _fighter;
			return _fighter;
		}
コード例 #8
0
    private bool checkEquip(int EquipNum, int count, MonsterTeam team)
    {
        int teamCount     = team.capacity;
        int requiredCount = 0;


        for (int pos = 0; pos < teamCount; ++pos)
        {
            Monster mon = team.getMember(pos);
            if (mon != null && mon.pid == this.pid)
            {
                Equipment equip1 = team.getEquip(pos, EquipData.TYPE_ATTACK);
                Equipment equip2 = team.getEquip(pos, EquipData.TYPE_DEFEND);

                if (equip1 != null && equip1.Num == EquipNum)
                {
                    requiredCount++;
                }

                if (equip2 != null && equip2.Num == EquipNum)
                {
                    requiredCount++;
                }

                break;
            }
        }

        return(requiredCount >= count);
    }
コード例 #9
0
    public void OnChangePos(ModifyMonsterCell cell)
    {
        if (m_curSelMonster == cell)
        {
            return;
        }

        cell.SetSelected(false);
        m_curSelMonster.SetSelected(true);

        string strName = m_curSelMonster.name;

        m_curSelMonster.name = cell.name;
        cell.name            = strName;

        MonsterTeam team = Core.Data.playerManager.RTData.curTeam;

        int cellPos = team.GetMonsterPos(cell.m_monster.pid);

        int curSelPos = team.GetMonsterPos(m_curSelMonster.m_monster.pid);

        team.removeMember(curSelPos);
        team.removeMember(cellPos);
        team.setMember(cell.m_monster, curSelPos);
        team.setMember(m_curSelMonster.m_monster, cellPos);
        m_grid.Reposition();

        SendChangePosMsg(cell.m_monster.pid, m_curSelMonster.m_monster.pid);
    }
コード例 #10
0
        private void btnSpawn_Click(object sender, EventArgs e)
        {
            MonsterTeam team        = new MonsterTeam();
            Character   focusedChar = DungeonScene.Instance.FocusedCharacter;
            CharData    character   = new CharData();

            character.BaseForm = focusedChar.CurrentForm;
            character.Nickname = "Clone";
            character.Level    = focusedChar.Level;

            for (int ii = 0; ii < CharData.MAX_SKILL_SLOTS; ii++)
            {
                character.BaseSkills[ii] = new SlotSkill(focusedChar.BaseSkills[ii]);
            }

            for (int ii = 0; ii < CharData.MAX_INTRINSIC_SLOTS; ii++)
            {
                character.BaseIntrinsics[ii] = focusedChar.BaseIntrinsics[ii];
            }

            Character new_mob = new Character(character, team);

            team.Players.Add(new_mob);
            new_mob.CharLoc      = focusedChar.CharLoc;
            new_mob.CharDir      = focusedChar.CharDir;
            new_mob.Tactic       = new AITactic(focusedChar.Tactic);
            new_mob.EquippedItem = new InvItem(focusedChar.EquippedItem);
            ZoneManager.Instance.CurrentMap.MapTeams.Add(new_mob.MemberTeam);
            new_mob.RefreshTraits();
            DungeonScene.Instance.PendingDevEvent = new_mob.OnMapStart();
        }
コード例 #11
0
    //初始化数据
    void Init()
    {
        Lab_DesAttribute.text = Core.Data.stringManager.getString(9114);
        CreateElement();

        MonsterTeam atk_team = Core.Data.playerManager.RTData.GetTeam(1);
        MonsterTeam def_team = Core.Data.playerManager.RTData.GetTeam(2);

        list_att = atk_team == null ? new List <Monster>()
        {
            null, null, null, null, null, null, null, null, null, null, null, null, null, null
        } :  atk_team.TeamMember;
        list_def = def_team == null ? new List <Monster>()
        {
            null, null, null, null, null, null, null, null, null, null, null, null, null, null
        } :  def_team.TeamMember;

//		for(int i=0;i<list_att.Count;i++)
//		{
//			if(list_att[i]==null)
//				Debug.LogError(i.ToString()+":null");
//			else
//				Debug.LogError(i.ToString()+":"+list_att[i].pid);
//		}

        //20级之前没有防御队
        if (Core.Data.playerManager.Lv < OpenDefListLv)
        {
            SetButtonStatus(0, 0);
            SetButtonStatus(1, 2);
            cur_allRolelist = list_att;
        }
        else
        {
            if (FightType == 0)
            {
                SetButtonStatus(0, 0);
                SetButtonStatus(1, 1);
                cur_allRolelist = list_att;
            }
            else
            {
                SetButtonStatus(0, 1);
                SetButtonStatus(1, 0);
                cur_allRolelist = list_def;
            }
        }

        RefreshPanel(cur_allRolelist);

        Spr_fightType.spriteName = this.FightType == 0 ? "BattleUI_Attack":"BattleUI_Defense";


        CreateElement2();

        DefalutSelect();
    }
コード例 #12
0
    private void SetMonsterTeam()
    {
        GetNewFinalTrialRankCheckInfoResponse res = DragonBallRankMgr.GetInstance().m_response;

        if (res.data.detail != null && res.data.detail.monteam != null && res.data.detail.monteam.Length != 0 && res.data.detail.monteam[m_teamindex].mon != null)
        {
            m_MonTeam = new MonsterTeam(1, res.data.detail.monteam[m_teamindex].mon.Count);
        }
        else
        {
            m_MonTeam = new MonsterTeam(1, 1);
        }
        foreach (string keys in res.data.detail.monteam[m_teamindex].mon.Keys)
        {
            int id = 0;
            if (res.data.detail.monteam[m_teamindex].mon.TryGetValue(keys, out id))
            {
                for (int i = 0; i < res.data.detail.monster.Length; i++)
                {
                    if (id == res.data.detail.monster[i].id)
                    {
                        Monster mon = res.data.detail.monster[i].toMonster(Core.Data.monManager);
                        int     pos = int.Parse(keys);
                        pos  = pos % 100;
                        pos -= 1;
                        m_MonTeam.setMember(mon, pos);
                        EquipInfo info = null;
                        if (res.data.detail.equip != null && res.data.detail.equip.Length != 0)
                        {
                            if (m_equipteamindex >= 0)
                            {
                                if (res.data.detail.equip[m_equipteamindex].EquipIdList[pos] != null)
                                {
                                    foreach (int _id in res.data.detail.equip[m_equipteamindex].EquipIdList[pos])
                                    {
                                        for (int t = 0; t < res.data.detail.eqip.Length; t++)
                                        {
                                            if (res.data.detail.eqip[t].id == _id)
                                            {
                                                info = res.data.detail.eqip[t];
                                                EquipData data = Core.Data.EquipManager.getEquipConfig(info.num);
                                                Equipment ment = new Equipment(info, data, Core.Data.gemsManager);
                                                m_MonTeam.setEquip(ment, pos);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                }
            }
        }
    }
コード例 #13
0
		public static MonsterTeam createMonsterTeam(Battle battle, List<FighterInfo> fighterProps, BattleSideEnum side)
		{
			MonsterTeam _team = new MonsterTeam(battle, side);
			foreach (FighterInfo _fighterProp in fighterProps)
			{
				BattleFighter _fighter = createMonsterFighterFromBattleProp(_team, _fighterProp);
				_team.addActor(_fighter);
			}
			_team.BattleSide = side;
			return _team;
		}
コード例 #14
0
    /// 刷新当前位置的装备
    /// </summary>
    /// <param name="index">Index.</param>
    public void RefreshEquipment(int index)
    {
        MonsterTeam _MyCurrentTeam = Core.Data.playerManager.RTData.curTeam;

        Equipment equip;

        equip = _MyCurrentTeam.getEquip(index, (short)0);
        m_atkEquip.Show(equip, 0);

        equip = _MyCurrentTeam.getEquip(index, (short)1);
        m_defEquip.Show(equip, 1);
    }
コード例 #15
0
    //根据teamid获取队伍信息
    public MonsterTeam getTeam(int teamId)
    {
        MonsterTeam mTeam = null;

        foreach (MonsterTeam team in myTeams)
        {
            if (team != null && team.TeamId == teamId)
            {
                mTeam = team;
                break;
            }
        }
        return(mTeam);
    }
コード例 #16
0
    private bool checkGender(short gender, int count, MonsterTeam team)
    {
        int teamCount  = team.capacity;
        int totalCount = 0;

        for (int pos = 0; pos < teamCount; ++pos)
        {
            Monster mon = team.getMember(pos);
            if (mon != null && mon.Gender == (Gender)gender)
            {
                totalCount++;
            }
        }

        return(totalCount >= count);
    }
コード例 #17
0
    private bool checkStar(int StarLevel, int count, MonsterTeam team)
    {
        int teamCount = team.capacity;

        int totalcCount = 0;

        for (int pos = 0; pos < teamCount; ++pos)
        {
            Monster mon = team.getMember(pos);
            if (mon != null && mon.Star == StarLevel)
            {
                totalcCount++;
            }
        }

        return(totalcCount >= count);
    }
コード例 #18
0
        public Team Spawn(IMobSpawnMap map)
        {
            List <MobSpawn> chosenSpawns = ChooseSpawns(map.Rand);

            if (chosenSpawns.Count > 0)
            {
                MonsterTeam team = new MonsterTeam();
                foreach (MobSpawn chosenSpawn in chosenSpawns)
                {
                    chosenSpawn.Spawn(team, map);
                }
                return(team);
            }
            else
            {
                return(null);
            }
        }
コード例 #19
0
 public void btnSpawn_Click()
 {
     lock (GameBase.lockObj)
     {
         if (GameManager.Instance.CurrentScene == DungeonScene.Instance)
         {
             MonsterTeam team    = new MonsterTeam();
             Character   new_mob = DungeonScene.Instance.FocusedCharacter.Clone(team);
             ZoneManager.Instance.CurrentMap.MapTeams.Add(new_mob.MemberTeam);
             new_mob.RefreshTraits();
             DungeonScene.Instance.PendingDevEvent = new_mob.OnMapStart();
         }
         else
         {
             GameManager.Instance.SE("Menu/Cancel");
         }
     }
 }
コード例 #20
0
    /// <summary>
    /// Checks my fate. 只有在队伍里面的才有缘分的价值,同时还有奥义数据
    /// </summary>
    /// <returns><c>true</c>, if my fate was checked, <c>false</c> otherwise.</returns>
    /// <param name="faDa">Fa da.</param>
    /// <param name="team">Team.</param>
    public bool checkMyFate(FateData faDa, MonsterTeam mTeam, List <AoYi> usedTeam)
    {
        bool check = true;

        if (faDa != null && mTeam != null && usedTeam != null)
        {
            int count = faDa.CountOfCondition;
            for (int i = 0; i < count; ++i)
            {
                int[] condition = faDa.MyFate(i);
                if (condition != null)
                {
                    ConfigDataType conData = (ConfigDataType)condition[FateData.Type_Pos];
                    int            ID      = condition[FateData.Item_ID_Pos];
                    int            amount  = condition[FateData.Item_Count_Pos];

                    switch (conData)
                    {
                    case ConfigDataType.HugeBeast:
                        check = checkAoYi(ID, amount, usedTeam) && check;
                        break;

                    case ConfigDataType.Gender:
                        check = checkGender((short)ID, amount, mTeam) && check;
                        break;

                    case ConfigDataType.Monster:
                        check = checkMonster(ID, amount, mTeam) && check;
                        break;

                    case ConfigDataType.Star:
                        check = checkStar(ID, amount, mTeam) && check;
                        break;

                    case ConfigDataType.Equip:
                        check = checkEquip(ID, amount, mTeam) && check;
                        break;
                    }
                }
            }
        }

        return(check);
    }
コード例 #21
0
ファイル: SwapTeamUI.cs プロジェクト: mengtest/DragonBallNew
    void InitUI()
    {
        m_curTeam = Core.Data.playerManager.RTData.curTeam;

        for (int i = 1; i <= 2; i++)
        {
            MonsterTeam team = Core.Data.playerManager.RTData.getTeam(i);
            if (team == null)
            {
                continue;
            }

            UIGrid gridParent = null;
            if (i == 1)
            {
                m_attackTeam = team;
                gridParent   = m_gridAttack;
            }
            else
            {
                m_defenceTeam = team;
                gridParent    = m_gridDefence;
            }

            m_txtAttack[i - 1].text  = team.teamAttack.ToString();
            m_txtDefence[i - 1].text = team.teamDefend.ToString();
            m_txtMember[i - 1].text  = team.validateMember.ToString() + "/" + team.capacity.ToString();

            for (int j = 0; j < team.capacity; j++)
            {
                Monster monster = team.getMember(j);
                if (monster != null)
                {
                    CreateMonsterHeadCell(monster, gridParent.transform, j.ToString());
                }
            }

            gridParent.Reposition();
        }

        ModifySwapBtnPos();
    }
コード例 #22
0
    private bool checkMonster(int MonNum, int count, MonsterTeam team)
    {
        int teamCount = team.capacity;

        int totalCount = 0;

        for (int pos = 0; pos < teamCount; ++pos)
        {
            Monster mon = team.getMember(pos);
            if (mon != null)
            {
                if (mon.num == MonNum)
                {
                    totalCount++;
                }
            }
        }

        return(totalCount >= count);
    }
コード例 #23
0
    /// <summary>
    /// Changes the team equip. 更改队伍的装备
    /// </summary>
    /// <param name="request">Request.</param>
    /// <param name="response">Response.</param>
    /// <param name="equipManager">Equip manager.</param>
    public void ChangeTeamEquip(BaseHttpRequest request, BaseResponse response, EquipManager equipManager)
    {
        if (request != null && response != null && equipManager != null)
        {
            ChangeEquipmentResponse resp = response as ChangeEquipmentResponse;

            if (resp != null && resp.data)
            {
                if (request.baseType == BaseHttpRequestType.Common_Http_Request)
                {
                    HttpRequest req = request as HttpRequest;
                    if (req != null)
                    {
                        ChangeEquipmentParam param = req.ParamMem as ChangeEquipmentParam;

                        if (param != null)
                        {
                            //获取编队
                            MonsterTeam team = RTData.getTeam(param.tmid);
                            //获取装备
                            Equipment srceq = equipManager.getEquipment(param.seqid);

                            if (team != null && srceq != null)
                            {
                                if (srceq != null)
                                {
                                    team.removeEquip(srceq, param.pos - 1);
                                }
                            }

                            Equipment equip = equipManager.getEquipment(param.teqid);
                            if (team != null && equip != null)
                            {
                                team.setEquip(equip, param.pos - 1);
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #24
0
        protected void PlaceEntities(T map, List <Loc> freeTiles)
        {
            List <EffectTile> tileTreasures = TileTreasures.GetSpawns(map);

            for (int kk = 0; kk < tileTreasures.Count && freeTiles.Count > 0; kk++)
            {
                int randIndex = map.Rand.Next(freeTiles.Count);

                EffectTile spawnedTrap = tileTreasures[kk];
                ((IPlaceableGenContext <EffectTile>)map).PlaceItem(freeTiles[randIndex], spawnedTrap);
                freeTiles.RemoveAt(randIndex);
            }

            List <MapItem> treasures = Treasures.GetSpawns(map);

            for (int kk = 0; kk < treasures.Count && freeTiles.Count > 0; kk++)
            {
                int randIndex = map.Rand.Next(freeTiles.Count);

                MapItem item = new MapItem(treasures[kk]);
                ((IPlaceableGenContext <MapItem>)map).PlaceItem(freeTiles[randIndex], item);

                freeTiles.RemoveAt(randIndex);
            }

            List <MobSpawn> guardTypes = GuardTypes.GetSpawns(map);

            for (int kk = 0; kk < guardTypes.Count && freeTiles.Count > 0; kk++)
            {
                int randIndex = map.Rand.Next(freeTiles.Count);

                MonsterTeam team    = new MonsterTeam();
                Character   newChar = guardTypes[kk].Spawn(team, map);
                newChar.CharLoc = freeTiles[randIndex];
                map.MapTeams.Add(newChar.MemberTeam);

                freeTiles.RemoveAt(randIndex);
            }
        }
コード例 #25
0
ファイル: SwapTeamUI.cs プロジェクト: mengtest/DragonBallNew
    void OnBtnSwap()
    {
        if (Core.Data.playerManager.Lv < 20)
        {
            string strText = Core.Data.stringManager.getString(5087);
            strText = string.Format(strText, 20);
            SQYAlertViewMove.CreateAlertViewMove(strText);
            return;
        }

        if (m_curTeam == m_attackTeam)
        {
            m_curTeam = m_defenceTeam;
        }
        else if (m_curTeam == m_defenceTeam)
        {
            m_curTeam = m_attackTeam;
        }

        SwapTeam();
        ModifySwapBtnPos();
    }
コード例 #26
0
    public void InitUI()
    {
        if (m_nCurTeamID != Core.Data.playerManager.RTData.curTeamId)
        {
            while (m_grid.transform.childCount > 0)
            {
                Transform tf = m_grid.transform.GetChild(0);
                tf.parent = null;
                Destroy(tf.gameObject);
            }

            m_nCurTeamID = Core.Data.playerManager.RTData.curTeamId;
            int         count = 0;
            MonsterTeam team  = Core.Data.playerManager.RTData.curTeam;
            for (int i = 0; i < team.capacity; i++)
            {
                Monster monster = team.getMember(i);
                if (monster != null)
                {
                    ModifyMonsterCell cell = CreateMonsterCell(monster);
                    if (count == 0)
                    {
                        cell.SetSelected(true);
                        m_curSelMonster = cell;
                    }
                    else
                    {
                        cell.SetSelected(false);
                    }
                    cell.name = (i + 11).ToString();
                    count++;
                }
            }

            m_grid.Reposition();
        }
    }
コード例 #27
0
ファイル: RoomGenGuardedCave.cs プロジェクト: PMDCollab/PMDC
        public override void DrawOnMap(T map)
        {
            Loc caveSize = ProposeSize(((IGenContext)map).Rand);

            if (caveSize.X != Draw.Width || caveSize.Y != Draw.Height)
            {
                DrawMapDefault(map);
                return;
            }

            //place room in a space that fits
            List <Loc> freeTiles = new List <Loc>();
            Loc        caveStart = Draw.Start + new Loc(2, 1);

            for (int x = 0; x < caveSize.X - 4; x++)
            {
                for (int y = 0; y < caveSize.Y - 4; y++)
                {
                    map.SetTile(new Loc(caveStart.X + x, caveStart.Y + y), map.RoomTerrain.Copy());
                    freeTiles.Add(new Loc(caveStart.X + x, caveStart.Y + y));
                }
            }
            //place tile treasures
            List <EffectTile> tileTreasures = TileTreasures.GetSpawns(map);

            for (int ii = 0; ii < tileTreasures.Count; ii++)
            {
                int        randIndex = ((IGenContext)map).Rand.Next(freeTiles.Count);
                EffectTile tile      = new EffectTile(tileTreasures[ii]);
                map.PlaceItem(freeTiles[randIndex], tile);
                freeTiles.RemoveAt(randIndex);
            }
            //place item treasures
            List <MapItem> treasures = Treasures.GetSpawns(map);

            for (int ii = 0; ii < treasures.Count; ii++)
            {
                int     randIndex = ((IGenContext)map).Rand.Next(freeTiles.Count);
                MapItem item      = treasures[ii];
                map.PlaceItem(freeTiles[randIndex], item);
                freeTiles.RemoveAt(randIndex);
            }

            //open the passage to the treasure room
            Loc tunnel = new Loc(caveStart.X + (caveSize.X - 4) / 2, caveStart.Y + caveSize.Y - 4);

            map.SetTile(tunnel, map.RoomTerrain.Copy());

            //dig the room into the treasure room
            for (int xx = 0; xx < 3; xx++)
            {
                for (int yy = 0; yy < 2; yy++)
                {
                    map.SetTile(new Loc(tunnel.X - 1 + xx, tunnel.Y + 1 + yy), map.RoomTerrain.Copy());
                }
            }


            //place monsters and items
            MonsterTeam team    = new MonsterTeam();
            Character   newChar = GuardTypes.Pick(((IGenContext)map).Rand).Spawn(team, map);

            map.PlaceItems(new TeamSpawn(team, false), new Loc[1] {
                tunnel
            });


            //dig tunnels within this room to hook up to the incoming demands
            foreach (Dir4 dir in DirExt.VALID_DIR4)
            {
                if (dir == Dir4.Up)
                {//if approached from the top, it must be either left or right.  Dig to that side and then dig up.
                    List <IntRange> upReq = RoomSideReqs[dir];
                    bool            left  = false;
                    bool            right = false;
                    for (int ii = 0; ii < upReq.Count; ii++)
                    {
                        bool hasLeft  = upReq[ii].Contains(Draw.Start.X) && BorderToFulfill[Dir4.Up][0];
                        bool hasRight = upReq[ii].Contains(Draw.End.X - 1) && BorderToFulfill[Dir4.Up][Draw.Width - 1];
                        if (hasLeft && hasRight)
                        {
                            if (((IGenContext)map).Rand.Next(2) == 0)
                            {
                                left = true;
                            }
                            else
                            {
                                right = true;
                            }
                        }
                        else
                        {
                            left  |= hasLeft;
                            right |= hasRight;
                        }
                    }
                    if (left)
                    {
                        DigAtBorder(map, Dir4.Left, Draw.End.Y - 1);
                        DigAtBorder(map, Dir4.Up, Draw.Start.X);
                    }
                    if (right)
                    {
                        DigAtBorder(map, Dir4.Right, Draw.End.Y - 1);
                        DigAtBorder(map, Dir4.Up, Draw.End.X - 1);
                    }
                }
                else if (dir == Dir4.Down)
                {//if approached from bottom, do nothing; we already fulfill every possibility
                }
                else
                {//if approached from the sides, dig at the bottommost Y of the room, because that was the only tile allowed.
                    if (RoomSideReqs[dir].Count > 0)
                    {
                        DigAtBorder(map, dir, Draw.End.Y - 1);
                    }
                }
            }

            for (int x = 0; x < Draw.Width; x++)
            {
                for (int y = 0; y < Draw.Height - 1; y++)
                {
                    Loc checkLoc = new Loc(Draw.X + x, Draw.Y + y);
                    if (!map.GetTile(checkLoc).TileEquivalent(map.RoomTerrain))
                    {
                        map.SetTile(checkLoc, map.UnbreakableTerrain.Copy());
                    }
                }
            }


            SetRoomBorders(map);
        }
コード例 #28
0
    /// <summary>
    /// 显示和隐藏不需要显示的组合技部分
    /// </summary>
    /// <value>The set show label and sprite.</value>
//	void SetShowLabelAndSprite(int showNum,string[] skillDes,string[] skillTitle)
//	{
//		int i = 0;
//		for (; i < showNum; i++) {
//			SkillDesLabelArray[i].gameObject.SetActive (true);
//			SkillDesLabelArray[i].text = skillDes[i];
//			SkillTitleBackgroundArray[i].gameObject.SetActive (true);
//			SkillTitleLabelArray[i].gameObject.SetActive (true);
//			SkillTitleLabelArray[i].text = skillTitle[i];
//
//		}
//		for (; i < 4; i++) {
//			SkillDesLabelArray [i].gameObject.SetActive (false);
//			SkillTitleBackgroundArray [i].gameObject.SetActive (false);
//			SkillTitleLabelArray [i].gameObject.SetActive (false);
//		}
//	}


    /// <summary>
    /// 显示界面并初始化信息,需要传一个数据参数
    /// </summary>
    /// <returns>The combination skill panel.</returns>
    /// <param name="root">Root.</param>
    public static CombinationSkillPanelScript ShowpbCombinationSkillPanel(GameObject root, Monster o, bool m_EnableClick = true, MonsterTeam m_Team = null)
    {
        GameObject obj = PrefabLoader.loadFromPack("GX/pbCombinationSkillPanel") as GameObject;

        if (obj != null)
        {
            GameObject go = NGUITools.AddChild(root, obj);
            CombinationSkillPanelScript script = go.GetComponent <CombinationSkillPanelScript>();
            script.InitPanel(o, m_Team);
            Instance = script;
            if (!m_EnableClick)
            {
                script.DisableBtnFateTarget();
            }
            return(script);
        }
        return(null);
    }
コード例 #29
0
        public MapTabEntitiesViewModel()
        {
            MonsterTeam team = new MonsterTeam();

            SelectedEntity        = new Character(new CharData(), team);
            SelectedEntity.Level  = 1;
            SelectedEntity.Tactic = new AITactic(DataManager.Instance.GetAITactic(0));
            team.Players.Add(SelectedEntity);

            Directions = new ObservableCollection <string>();
            foreach (Dir8 dir in DirExt.VALID_DIR8)
            {
                Directions.Add(dir.ToLocal());
            }

            Tactics = new ObservableCollection <string>();
            string[] tactic_names = DataManager.Instance.DataIndices[DataManager.DataType.AI].GetLocalStringArray();
            for (int ii = 0; ii < tactic_names.Length; ii++)
            {
                Tactics.Add(ii.ToString("D2") + ": " + tactic_names[ii]);
            }

            Monsters = new ObservableCollection <string>();
            string[] monster_names = DataManager.Instance.DataIndices[DataManager.DataType.Monster].GetLocalStringArray();
            for (int ii = 0; ii < monster_names.Length; ii++)
            {
                Monsters.Add(ii.ToString("D3") + ": " + monster_names[ii]);
            }

            Forms = new ObservableCollection <string>();

            Skins = new ObservableCollection <string>();
            string[] skin_names = DataManager.Instance.DataIndices[DataManager.DataType.Skin].GetLocalStringArray();
            for (int ii = 0; ii < DataManager.Instance.DataIndices[DataManager.DataType.Skin].Count; ii++)
            {
                Skins.Add(skin_names[ii]);
            }

            Genders = new ObservableCollection <string>();
            for (int ii = 0; ii <= (int)Gender.Female; ii++)
            {
                Genders.Add(((Gender)ii).ToLocal());
            }

            Intrinsics = new ObservableCollection <string>();
            string[] intrinsic_names = DataManager.Instance.DataIndices[DataManager.DataType.Intrinsic].GetLocalStringArray();
            for (int ii = 0; ii < intrinsic_names.Length; ii++)
            {
                Intrinsics.Add(ii.ToString("D3") + ": " + intrinsic_names[ii]);
            }

            Equips = new ObservableCollection <string>();
            Equips.Add("---: None");
            string[] item_names = DataManager.Instance.DataIndices[DataManager.DataType.Item].GetLocalStringArray();
            for (int ii = 0; ii < item_names.Length; ii++)
            {
                Equips.Add(ii.ToString("D3") + ": " + item_names[ii]);
            }

            Skills = new ObservableCollection <string>();
            Skills.Add("---: None");
            string[] skill_names = DataManager.Instance.DataIndices[DataManager.DataType.Skill].GetLocalStringArray();
            for (int ii = 0; ii < skill_names.Length; ii++)
            {
                Skills.Add(ii.ToString("D3") + ": " + skill_names[ii]);
            }

            speciesChanged();

            Statuses = new CollectionBoxViewModel(new StringConv(typeof(StatusEffect), new object[0]));
            Statuses.OnMemberChanged += Statuses_Changed;
            Statuses.OnEditItem      += Statuses_EditItem;
        }
コード例 #30
0
    private void InitUI()
    {
        if (m_data != null)
        {
            AtlasMgr.mInstance.SetHeadSprite(head, m_data.num.ToString());
            stars.SetStar(m_data.config.star);

            m_txtName.text = m_data.config.name;
            m_txtDesp.text = m_data.config.description;

            int index = 0;
            for (; index < m_data.config.skill.Length; index++)
            {
                SkillData skill = Core.Data.skillManager.getSkillDataConfig(m_data.config.skill[index]);
                if (skill == null)
                {
                    RED.SetActive(false, m_spSkill[index].transform.parent.gameObject);
                    continue;
                }
                m_txtSkill[index].text = skill.name;

                // m_spSkill[index].spriteName = m_data.config.skill[index].ToString();
                m_spSkill [index].spriteName = skill.Icon.ToString();
            }

            List <FateData> o        = m_data.getMyFate(Core.Data.fateManager);
            List <AoYi>     aoyiList = Core.Data.dragonManager.usedToList();
            MonsterTeam     myteam   = Core.Data.playerManager.RTData.curTeam;
            int             count    = o.Count;

            //Debug.Log("count======"+count.ToString());

            for (int i = 0; i < count; i++)
            {
                m_txtFataTitle[i].text = o[i].name;
                //Debug.Log(o[i].name);
                m_txtFate[i].text = o[i].description;
                //Debug.Log(o[i].description);
                if (m_data.checkMyFate(o[i], myteam, aoyiList))
                {
                    m_txtFataTitle[i].color = new Color(1f, 227f / 255, 43f / 255);
                    m_txtFate[i].color      = new Color(1f, 227f / 255, 43f / 255);
                }
                else
                {
                    m_txtFataTitle[i].color = Color.white;
                    m_txtFate[i].color      = Color.white;
                }
            }

            for (; count < m_txtFate.Length; count++)
            {
                //Debug.Log("bu ke jian");
                RED.SetActive(false, m_txtFate[count].gameObject, m_txtFataTitle[count].parent.gameObject);
            }

            m_btnSell.TextID = 5030;

            Lab_Atk.text = m_data.config.atk.ToString();
            Lab_Def.text = m_data.config.def.ToString();

            if (m_data.RTData == null)
            {
                UIAttribute_Border.color = new Color(0, 0, 0, 1f);
            }
        }
    }
コード例 #31
0
    /// <summary>
    /// 初始化界面信息
    /// </summary>
    public void InitPanel(Monster mt, MonsterTeam m_Team = null)
    {
        CharacterLabel.text = mt.config.description;
        //SetShowLabelAndSprite(,,,);
        List <FateData> o = mt.getMyFate(Core.Data.fateManager);

        fateList = o;
        List <AoYi> aoyiList = Core.Data.dragonManager.usedToList();
        MonsterTeam myteam   = null;

        if (m_Team == null)
        {
            myteam = Core.Data.playerManager.RTData.curTeam;
        }
        else
        {
            myteam = m_Team;
        }
        int count = o.Count;

        for (int i = 0; i < SkillTitleLabelArray.Length; i++)
        {
            SkillTitleBackgroundArray[i].gameObject.SetActive(false);
            SkillTitleLabelArray [i].gameObject.SetActive(false);
            SkillDesLabelArray [i].gameObject.SetActive(false);
            btnFateTarget [i].gameObject.SetActive(false);
        }
        specialLblTitle.text = Core.Data.stringManager.getString(7335);
        specialLblDesp.text  = string.Format(Core.Data.stringManager.getString(7336), mt.config.nuqi1);

        int AllSetUp = 0;

        specialLblDesp.transform.localPosition  = specialDespPos + Vector3.down * count * 60;
        specialLblTitle.transform.localPosition = titlePos + Vector3.down * count * 60;
        specialBg.transform.localPosition       = bgTitleBgPos + Vector3.down * count * 60;

        for (int i = 0; i < count; i++)
        {
            SkillTitleBackgroundArray[i].gameObject.SetActive(true);
            SkillTitleLabelArray [i].gameObject.SetActive(true);
            SkillDesLabelArray [i].gameObject.SetActive(true);
            btnFateTarget [i].gameObject.SetActive(true);
            SkillTitleLabelArray [i].text = o [i].name;
            string tStrColor = "";
            if (mt.checkMyFate(o [i], myteam, aoyiList))
            {
                SkillTitleBackgroundArray[i].spriteName = "battle-0010";
                SkillTitleLabelArray [i].color          = Color.white;
                //  SkillDesLabelArray [i].color = lightColor;
                tStrColor = strColor;
                AllSetUp++;
            }
            else
            {
                SkillTitleBackgroundArray[i].spriteName = "common-0028";
                SkillTitleLabelArray [i].color          = Color.white;
                SkillDesLabelArray [i].color            = Color.white;
            }
            addAng = string.Format(Core.Data.stringManager.getString(1008), o[i].nuqi.ToString());
            SkillDesLabelArray [i].text = tStrColor + o [i].description + addAng;
        }
        if (count != 0)
        {
            if (AllSetUp == count)
            {
                //specialLblDesp.color = lightColor;
                specialLblDesp.text   = strColor + specialLblDesp.text;
                specialLblTitle.color = Color.white;
                specialBg.spriteName  = "battle-0010";
            }
            else
            {
                specialLblDesp.color  = Color.white;
                specialLblTitle.color = Color.white;
                specialBg.spriteName  = "common-0028";
            }
        }
        else
        {
            specialLblDesp.gameObject.SetActive(false);
            specialLblTitle.gameObject.SetActive(false);
            specialBg.gameObject.SetActive(false);
        }
    }
コード例 #32
0
    public void InitUI(int pos)
    {
        m_nPos = pos;
        MonsterTeam curTeam = Core.Data.playerManager.RTData.curTeam;

        if (IsLock(pos))
        {
            RED.SetActive(false, m_spProp.gameObject, m_txtLv.gameObject, m_EmptyEquip.gameObject);
            AtlasMgr.mInstance.SetHeadSprite(m_spHead, AtlasMgr.HEAD_LOCK);
            m_spHead.width  = 54;
            m_spHead.height = 61;

            string strTip = "";
            if (pos != 1)
            {
                strTip = Core.Data.stringManager.getString(5091);
                strTip = string.Format(strTip, Core.Data.playerManager.GetMonSlotUnLockLvl(pos + 1));
            }
            else
            {
                strTip = Core.Data.stringManager.getString(9111);
                strTip = string.Format(strTip, RED.GetChineseNum(4));
            }
            m_txtTip.text = strTip;
        }
        else
        {
            m_monster = curTeam.getMember(pos);
            if (m_monster != null)
            {
                RED.SetActive(true, m_spBg.gameObject, m_spProp.gameObject, m_txtLv.gameObject);
                AtlasMgr.mInstance.SetHeadSprite(m_spHead, m_monster.num.ToString());
                m_spBg.spriteName   = "star" + ((int)(m_monster.RTData.m_nAttr)).ToString();
                m_spProp.spriteName = "Attribute_" + ((int)(m_monster.RTData.Attribute)).ToString();
                m_txtLv.text        = "Lv" + m_monster.RTData.curLevel.ToString();



                if (voidPosEffect != null)
                {
                    RED.SetActive(false, voidPosEffect);
                }

                int count = 0;
                for (short i = 0; i < 2; i++)
                {
                    Equipment equip = Core.Data.playerManager.RTData.curTeam.getEquip(pos, i);
                    if (equip == null)
                    {
                        if (Core.Data.EquipManager.GetValidEquipCount(i, SplitType.Split_If_InCurTeam) > 0)
                        {
                            count++;
                        }
                    }
                }
                RED.SetActive(count > 0, m_EmptyEquip);
                m_spHead.MakePixelPerfect();
            }
            else
            {
                RED.SetActive(false, m_spBg.gameObject, m_spProp.gameObject, m_txtLv.gameObject);
                //AtlasMgr.mInstance.SetHeadSprite(m_spHead, AtlasMgr.HEAD_ADD);
                if (voidPosEffect != null)
                {
                    RED.SetActive(true, voidPosEffect);
                    int count = Core.Data.monManager.GetValidMonCount(SplitType.Split_If_InCurTeam);
                    RED.SetActive(count > 0, m_EmptyEquip.gameObject);
                }
                m_spHead.width  = 100;
                m_spHead.height = 100;
            }

            m_txtTip.text = "";
        }
    }