public void StartUp() { //DLog.Log("Dungeon start up"); foreach (Component component in components) { component.StartUp(); } CheckStagesIsConfigProperly(); activeStage = stages[0]; activeStageComponent = new StageComponent(activeStage); AddComponent(activeStageComponent); CheckStageCountMatchGateCount(); if (gates.Count > 0) { activeGateController = gates[0]; } CheckStageCountMatchStageActivatorCount(); if (stageActivators.Count > 0) { activeStageActivator = stageActivators[0]; } activeStage.OnStart(); activeStage.ListenToWaveCycle(OnWaveCycle); DungeonActionComponent actionComponent = new DungeonActionComponent(actions); AddComponent(actionComponent); }
public static BaseSource ConvertToSource(StageComponent comp) { if (comp is VideoMedia media) { if (media.FromYoutube) { return(new YoutubeSource(media.Identifier, media.Thumbnail.OriginalString, media.DownloadID)); } else { return(new ExternalVideoSource() { FullPath = media.Path, Id = media.Id, ThumbnailUri = media.Thumbnail.OriginalString, Title = media.Identifier, }); } } else if (comp is LightComponent lightComponent) { return(new LightSource() { Id = lightComponent.Id, MovingData = BoardSerializer.SerializeToString(lightComponent.SetterBoard), Title = lightComponent.Identifier, }); } return(null); }
private void StartNextStage(StageComponent current) { current.IsActive = false; ChangeSpawnerState(current.gameObject, false); ChangeSpawnerState(current.nextStage.gameObject, true); current.nextStage.IsActive = true; }
public void StageUnLoadAB(StageComponent stage) { if (loadMode == ResourceLoadMode.AssetBundle) { StageInfo info = UIInfo.stageInfoDict[stage.GetType()]; abLoader.StageUnLoadAB(info.abName); } }
public void ImportData(List <ItemPosition> items, IEnumerable <StageComponent> MediaItems) { Dictionary <string, StageComponent> dictionary = MediaItems.ToDictionary(i => i.Id, i => i); foreach (ItemPosition item in items) { StageComponent component = dictionary[item.ItemId]; AddItem(component, item); } Tracks.ForEach(i => i.RelocationTrackItems()); Track_ItemsMaxWidthChanged(null, null); }
private void RegisterComponent(StageComponent stage) { if (stage) { stage .UpdateAsObservable() .Where(unit => stage.IsActive) .Where(unit => CheckStageForDone(stage)) .Subscribe(unit => stage.IsDone.Value = true) .AddTo(stage); stage.IsDone .Where(b => b) .Subscribe(_ => StartNextStage(stage)) .AddTo(stage); } }
private void AddItem(StageComponent component, ItemPosition itemPosition) { var track = Tracks.Where(i => i.SourceType == itemPosition.SourceType && i.TrackNumber == itemPosition.TrackNumber).FirstOrDefault(); if (track == null) { track = AddTrack(itemPosition.SourceType, itemPosition.TrackNumber); } TrackItem item = track.BuildItem(component); item.Offset = itemPosition.Offset; item.FrameWidth = itemPosition.FrameWidth; item.ForwardOffset = itemPosition.ForwardOffset; item.BackwardOffset = itemPosition.BackwardOffset; item.Property = itemPosition.Property; track.AddItem(item); }
private void MoveToNextStage() { activeStage.UnlistenToWaveCycle(OnWaveCycle); int indexOfActiveStage = stages.IndexOf(activeStage); NotifyStageCycle(indexOfActiveStage + 1, StageCycle.End); activeStage = stages[indexOfActiveStage + 1]; activeStage.OnStart(); activeStage.ListenToWaveCycle(OnWaveCycle); components.Remove(activeStageComponent); activeStageComponent = new StageComponent(activeStage); activeStageComponent.StartUp(); activeStageComponent.Start(); AddComponent(activeStageComponent); currentStageOrder = indexOfActiveStage + 2; NotifyStageCycle(currentStageOrder, StageCycle.Start); //DLog.Log("NEXT STAGE"); }
public IDataResult <IStageComponent> GetComponent(DrawFileComponentType type) { ComponentValidator componentValidator = new ComponentValidator(); IResult result = componentValidator.ValidateComponent(type); IDataResult <IStageComponent> dataResult = result as IDataResult <IStageComponent>; if (result.Success) { switch (type) { case DrawFileComponentType.Stage: IStageComponent stage = new StageComponent(); stage.SubComponents = new System.Collections.Generic.List <IStageComponent>(); break; case DrawFileComponentType.SubStage: break; case DrawFileComponentType.Team: break; case DrawFileComponentType.Topic: break; } } //DataResult<IStageComponent> dataResult = new DataResult<IStageComponent>(); //IStageComponent stage = new StageComponent(); //IFileData fileData = new FileData(); //fileData.CurrentComponent = new MemoryStream(); //stage.CurrentComponentFileData = fileData; //dataResult.Data = stage; return(dataResult); }
public static void RegisterStageComponent(StageComponent _component) { t._stageComponents.Add(_component); }
private bool CheckStageForDone(StageComponent stage) { SpawnerComponent[] spawners = stage.GetComponentsInChildren <SpawnerComponent>(); return(spawners == null || spawners.All(component => component.IsActive == false)); }
/// <summary> /// 离开Stage时自动调用,不需手动调用 /// </summary> public void LeaveStage(StageComponent component) { component.Clear(); currentActiveStage.Remove(component); }
/// <summary> /// 进入Stage时自动调用,不需手动调用 /// </summary> public void EnterStage(StageComponent component) { currentActiveStage.Add(component); }