public bool Reset(int LevelID) { this.Clear(); SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext(); DebugHelper.Assert(curLvelContext != null); if (curLvelContext == null) { return(false); } for (int i = 0; i < curLvelContext.m_starDetail.Length; i++) { ResDT_IntParamArrayNode resDT_IntParamArrayNode = curLvelContext.m_starDetail[i]; if (resDT_IntParamArrayNode.iParam == 0) { break; } this.AddStarEvaluation(resDT_IntParamArrayNode.iParam); } if (curLvelContext.m_loseCondition != 0) { ResEvaluateStarInfo dataByKey = GameDataMgr.evaluateCondInfoDatabin.GetDataByKey((uint)curLvelContext.m_loseCondition); DebugHelper.Assert(dataByKey != null); if (dataByKey == null) { return(false); } this.FailureEvaluation = this.CreateStar(dataByKey, 0); DebugHelper.Assert(this.FailureEvaluation != null, "我擦,怎会没有?"); } Singleton <EventRouter> .get_instance().BroadCastEvent(EventID.StarSystemInitialized); return(true); }
public bool Reset(SLevelContext levelContext, bool bMultiGame) { this.Clear(); bool result = false; if (levelContext.IsMobaModeWithOutGuide()) { this.CurLevelTimeDuration = levelContext.m_timeDuration; if (levelContext.m_addWinCondStarId != 0u) { ResEvaluateStarInfo dataByKey = GameDataMgr.addWinLoseCondDatabin.GetDataByKey(levelContext.m_addWinCondStarId); DebugHelper.Assert(dataByKey != null); if (dataByKey != null) { this.WinnerEvaluation = this.CreateStar(dataByKey); DebugHelper.Assert(this.WinnerEvaluation != null, "我擦,怎会没有?"); result = true; } } if (levelContext.m_addLoseCondStarId != 0u) { ResEvaluateStarInfo dataByKey2 = GameDataMgr.addWinLoseCondDatabin.GetDataByKey(levelContext.m_addLoseCondStarId); DebugHelper.Assert(dataByKey2 != null); if (dataByKey2 != null) { this.LoserEvaluation = this.CreateStar(dataByKey2); DebugHelper.Assert(this.LoserEvaluation != null, "我擦,怎会没有?"); result = true; } } } return result; }
public bool Reset(int LevelID) { this.Clear(); ResLevelCfgInfo info = FindLevelConfig(LevelID); DebugHelper.Assert(info != null); if (info == null) { return(false); } for (int i = 0; i < info.astStarDetail.Length; i++) { ResDT_IntParamArrayNode node = info.astStarDetail[i]; if (node.iParam == 0) { break; } this.AddStarEvaluation(node.iParam); } if (info.iLoseCondition != 0) { ResEvaluateStarInfo dataByKey = GameDataMgr.evaluateCondInfoDatabin.GetDataByKey((uint)info.iLoseCondition); DebugHelper.Assert(dataByKey != null); if (dataByKey == null) { return(false); } this.FailureEvaluation = this.CreateStar(dataByKey, 0); DebugHelper.Assert(this.FailureEvaluation != null, "我擦,怎会没有?"); } Singleton <EventRouter> .instance.BroadCastEvent(EventID.StarSystemInitialized); return(true); }
private void OnStarSystemChanged(IStarEvaluation InStarEvaluation, IStarCondition InStarCondition) { if ((Singleton <StarSystem> .instance.winEvaluation == InStarEvaluation) && Singleton <StarSystem> .instance.isFirstStarCompleted) { PoolObjHandle <ActorRoot> handle; PoolObjHandle <ActorRoot> handle2; InStarCondition.GetActorRef(out handle, out handle2); Singleton <BattleLogic> .instance.OnWinning(handle, handle2); } }
private void OnFailureEvaluationChanged(IStarEvaluation InStarEvaluation, IStarCondition InStarCondition) { if ((Singleton <StarSystem> .instance.failureEvaluation == InStarEvaluation) && Singleton <StarSystem> .instance.isFailure) { PoolObjHandle <ActorRoot> handle; PoolObjHandle <ActorRoot> handle2; InStarCondition.GetActorRef(out handle, out handle2); Singleton <BattleLogic> .instance.OnFailure(handle, handle2); } }
protected void AddStarEvaluation(int CondID) { ResEvaluateStarInfo dataByKey = GameDataMgr.evaluateCondInfoDatabin.GetDataByKey((uint)CondID); DebugHelper.Assert(dataByKey != null); if (dataByKey != null) { IStarEvaluation item = this.CreateStar(dataByKey, this.StarEvaluations.Count); this.StarEvaluations.Add(item); } }
protected void AddStarEvaluation(int CondID) { ResEvaluateStarInfo dataByKey = GameDataMgr.evaluateCondInfoDatabin.GetDataByKey((uint)CondID); DebugHelper.Assert(dataByKey != null); if (dataByKey == null) { return; } IStarEvaluation starEvaluation = this.CreateStar(dataByKey, this.StarEvaluations.get_Count()); this.StarEvaluations.Add(starEvaluation); }
private void OnEvaluationChangedInner(IStarEvaluation InStarEvaluation, IStarCondition InStarCondition) { if (InStarEvaluation == this.FailureEvaluation) { if (this.OnFailureEvaluationChanged != null) { this.OnFailureEvaluationChanged(InStarEvaluation, InStarCondition); } } else if (this.OnEvaluationChanged != null) { this.OnEvaluationChanged(InStarEvaluation, InStarCondition); } }
private void OnActorDeath(ref DefaultGameEventParam prm) { for (int i = this.StarEvaluations.Count - 1; (i >= 0) && (i < this.StarEvaluations.Count); i--) { IStarEvaluation evaluation = this.StarEvaluations[i]; if (evaluation != null) { evaluation.OnActorDeath(ref prm); } } if (this.FailureEvaluation != null) { this.FailureEvaluation.OnActorDeath(ref prm); } }
public void Clear() { if (this.WinnerEvaluation != null) { this.WinnerEvaluation.Dispose(); this.WinnerEvaluation = null; } if (this.LoserEvaluation != null) { this.LoserEvaluation.Dispose(); this.LoserEvaluation = null; } Singleton<GameEventSys>.instance.RmvEventHandler<GameDeadEventParam>(GameEventDef.Event_PostActorDead, new RefAction<GameDeadEventParam>(this.OnActorDeath)); Singleton<GameEventSys>.instance.RmvEventHandler<SCampScoreUpdateParam>(GameEventDef.Event_CampScoreUpdated, new RefAction<SCampScoreUpdateParam>(this.OnCampScoreUpdated)); this.CurLevelTimeDuration = 0u; this.bStarted = false; }
private void OnActorDeath(ref GameDeadEventParam prm) { int num = this.StarEvaluations.get_Count() - 1; while (num >= 0 && num < this.StarEvaluations.get_Count()) { IStarEvaluation starEvaluation = this.StarEvaluations.get_Item(num); if (starEvaluation != null) { starEvaluation.OnActorDeath(ref prm); } num--; } if (this.FailureEvaluation != null) { this.FailureEvaluation.OnActorDeath(ref prm); } }
public void Clear() { ListView <IStarEvaluation> .Enumerator enumerator = this.StarEvaluations.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.get_Current() != null) { enumerator.get_Current().Dispose(); } } this.StarEvaluations.Clear(); if (this.FailureEvaluation != null) { this.FailureEvaluation.Dispose(); this.FailureEvaluation = null; } Singleton <GameEventSys> .get_instance().RmvEventHandler <GameDeadEventParam>(GameEventDef.Event_PostActorDead, new RefAction <GameDeadEventParam>(this.OnActorDeath)); }
public bool Reset(int LevelID, bool bMultiGame) { this.Clear(); ResDT_LevelCommonInfo outLevelComInfo = null; if (bMultiGame) { outLevelComInfo = CLevelCfgLogicManager.FindLevelConfigMultiGame(LevelID); } else { ResLevelCfgInfo outLevelCfg = null; CLevelCfgLogicManager.FindLevelConfigSingleGame(LevelID, out outLevelCfg, out outLevelComInfo); } bool flag = false; if (outLevelComInfo != null) { this.CurLevelTimeDuration = outLevelComInfo.dwTimeDuration; if (outLevelComInfo.dwAddWinCondStarId != 0) { ResEvaluateStarInfo dataByKey = GameDataMgr.addWinLoseCondDatabin.GetDataByKey(outLevelComInfo.dwAddWinCondStarId); DebugHelper.Assert(dataByKey != null); if (dataByKey != null) { this.WinnerEvaluation = this.CreateStar(dataByKey); DebugHelper.Assert(this.WinnerEvaluation != null, "我擦,怎会没有?"); flag = true; } } if (outLevelComInfo.dwAddLoseCondStarId != 0) { ResEvaluateStarInfo conditionDetail = GameDataMgr.addWinLoseCondDatabin.GetDataByKey(outLevelComInfo.dwAddLoseCondStarId); DebugHelper.Assert(conditionDetail != null); if (conditionDetail != null) { this.LoserEvaluation = this.CreateStar(conditionDetail); DebugHelper.Assert(this.LoserEvaluation != null, "我擦,怎会没有?"); flag = true; } } } return(flag); }
public void OnEvaluationChange(IStarEvaluation InStarEvaluation, IStarCondition InStarCondition) { if (this.conditionTexts[InStarEvaluation.index] != null) { this.conditionTexts[InStarEvaluation.index].text = InStarEvaluation.description; } Transform transform = this.m_Obj.transform.Find("TaskPanel").transform; if (transform != null) { if (InStarEvaluation.isSuccess) { transform.Find(string.Format("Condition{0}", InStarEvaluation.index + 1)).GetComponent <Text>().color = Color.green; } else { transform.Find(string.Format("Condition{0}", InStarEvaluation.index + 1)).GetComponent <Text>().color = Color.white; } } }