/// <summary> /// 生成一组测试数据 /// </summary> public void GenerateExam(ExamSetting examSetting) { ExamData examData = new ExamData(); examData.SettingId = examSetting.id.ToInt32(); RoleManager.Instance._CurGameInfo.CurActionData.CurExamData = examData; for (int i = 0; i < 8; i++) { SingleExamEnemy enemy = new SingleExamEnemy(); enemy.Id = DataTable.FindTestEnemyNumerialByLevel(examSetting.level.ToInt32()).id.ToInt32(); enemy.Status = (int)SingleExamEnemyStatus.UnAccomplished; enemy.OnlyId = ConstantVal.SetId; InitExamProperty(enemy); RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList.Add(enemy); } //生成玩家的数据 int count = RoleManager.Instance.playerPeople.protoData.PropertyData.ExamPropertyIdList.Count; RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyIdList.Clear(); RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyDataList.Clear(); for (int i = 0; i < count; i++) { int theId = RoleManager.Instance.playerPeople.protoData.PropertyData.ExamPropertyIdList[i]; SinglePropertyData pro = RoleManager.Instance.playerPeople.protoData.PropertyData.ExamPropertyDataList[i]; SinglePropertyData newPro = pro.Clone(); RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyIdList.Add(theId); RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyDataList.Add(newPro); } //发消息给view显示数据 EventCenter.Broadcast(TheEventType.StartExam); }
/// <summary> /// 刷新显示 /// </summary> public void RefreshShow() { UInt64 enemyId = singleEnemy.OnlyId; singleEnemy = ExamManager.Instance.FindSingleExamEnemyWithOnlyId(enemyId); OnOpenIng(); }
public override void Init(params object[] args) { base.Init(args); basicAttackSpeed = 1; this.curEnemy = args[0] as SingleExamEnemy; EventCenter.Register(TheEventType.BattleHit, OnHit); EventCenter.Register(TheEventType.BattleEnd, OnBattleEnd); if (isTestBattle) { addBtnListener(btn_restartTest, () => { RoleManager.Instance.TestSetProperty(true, enemyLevel); RoleManager.Instance.TestSetProperty(false, roleLevel); TestBattle(); }); addBtnListener(btn_NextEnemy, () => { RoleManager.Instance.TestSetProperty(true, enemyLevel); // RoleManager.Instance.TestSetProperty(false, roleLevel); TestBattle(); }); } else { btn_restartTest.gameObject.SetActive(false); btn_NextEnemy.gameObject.SetActive(false); } }
/// <summary> /// 找是否完成所有考试 /// </summary> /// <returns></returns> public bool CheckIfAccomplishAllExam() { for (int i = 0; i < RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList.Count; i++) { SingleExamEnemy enemy = RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList[i]; if (enemy.Status != (int)SingleExamEnemyStatus.Accomplished) { return(false); } } return(true); }
/// <summary> /// 通过唯一id获取考卷 /// </summary> public SingleExamEnemy FindSingleExamEnemyWithOnlyId(UInt64 onlyId) { int count = RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList.Count; for (int i = 0; i < count; i++) { SingleExamEnemy enemy = RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList[i]; if (enemy.OnlyId == onlyId) { return(enemy); } } return(null); }
/// <summary> /// 初始化属性 /// </summary> public void InitPro(PropertyData thePro) { UInt64 onlyId = thePro.OnlyId; if (thePro.IsPlayer) { singleEnemy = null; pro = RoleManager.Instance.FindPeopleWithOnlyId(onlyId).protoData.PropertyData; } else { singleEnemy = ExamManager.Instance.FindSingleExamEnemyWithOnlyId(onlyId); pro = singleEnemy.Property; } }
/// <summary> /// 初始化考试属性 /// </summary> /// <param name="singleExamEnemy"></param> public void InitExamProperty(SingleExamEnemy singleExamEnemy) { //singleExamEnemy.Id; TestEnemyNumerialSetting setting = DataTable.FindTestEnemyNumerial(singleExamEnemy.Id); //singleExamEnemy.CurPropertyList.Clear(); singleExamEnemy.Property = new PropertyData(); singleExamEnemy.Property.OnlyId = singleExamEnemy.OnlyId; InitExamProperty(PropertyIdType.Attack, setting.attack.ToInt32(), singleExamEnemy.Property); InitExamProperty(PropertyIdType.Defense, setting.defense.ToInt32(), singleExamEnemy.Property); InitExamProperty(PropertyIdType.CritRate, setting.critRate.ToFloat(), singleExamEnemy.Property); InitExamProperty(PropertyIdType.CritNum, setting.crit.ToFloat(), singleExamEnemy.Property); InitExamProperty(PropertyIdType.SkillAdd, setting.skillHurtAdd.ToFloat(), singleExamEnemy.Property); InitExamProperty(PropertyIdType.Hp, setting.hp.ToInt32(), singleExamEnemy.Property); InitExamProperty(PropertyIdType.Speed, setting.attackSpeed.ToFloat(), singleExamEnemy.Property); }
public Button btn_battle;//开战 public override void Init(params object[] args) { base.Init(args); singleEnemy = args[0] as SingleExamEnemy; addBtnListener(btn_battle, () => { //如果精力耗尽,则输 if (RoleManager.Instance.FindSinglePropertyData(PropertyIdType.Hp).PropertyNum <= 0) { PanelManager.Instance.OpenFloatWindow("精力已耗尽,无法做题"); } else { ExamManager.Instance.StartSingleQuestion(singleEnemy); } }); }
/// <summary> /// 得分 /// </summary> public int GetScore(PropertyData pro) { for (int i = 0; i < RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList.Count; i++) { SingleExamEnemy enemy = RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList[i]; if (enemy.OnlyId == pro.OnlyId) { enemy.Status = (int)SingleExamEnemyStatus.Accomplished; break; } } RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.CurScore += 13; if (RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.CurScore >= 100) { RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.CurScore = 100; } //弹出结算面板 return(13); }
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) }
/// <summary> /// 开始单个题目 进入战斗面板 /// </summary> public void StartSingleQuestion(SingleExamEnemy enemy) { //ExamSetting setting= PanelManager.Instance.OpenPanel <BattlePanel>(PanelManager.Instance.trans_layer2, enemy); }