public void setAppearenceSet(long setKey) { Debug.Log("set appearence set to key:" + setKey, this.gameObject); // clear all the previous "clothing" clearGearSlot(GearSlot.CAPE); clearGearSlot(GearSlot.LEGS); clearGearSlot(GearSlot.SHOULDER); clearGearSlot(GearSlot.HEAD); clearGearSlot(GearSlot.HANDS); clearGearSlot(GearSlot.FEET); clearGearSlot(GearSlot.TORSO); CObject obj = DBInst.inst.toObj(7638, setKey); CObject setParts = obj.getMember(2); foreach (CObject part in setParts.members) { ClothingItem item = new ClothingItem(DBInst.inst, int.Parse(part.convert().ToString())); setGearSlotKey(item.allowedSlots.First(), item.key); } if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
public async Task <Class> ModifyClassState(string teacherId, string classId, ClassState state) { // TODO fetch real teacher // TODO fetch real class if (!_classes.ContainsKey(classId)) { throw new ClassNotFoundException(); } bool teacherExists = false; Class @class = _classes[classId]; foreach (var teacher in @class.Teachers) { if (teacher.Id == teacherId) { teacherExists = true; break; } } if (teacherExists) { @class.State = state; } return(@class); }
public void FixedUpdate() { if (state == ClassState.UPDATE) { updateRaceGender(); checkFemaleModesty(); // set the ref model to be all visible, overriden parts will be hidden later when parts are added SetActiveRecursively(refModel, true); // remove all the existing parts // FIXME: Don't clear them, just disable them costumeParts.transform.Clear(); // always hide the boots enableDisableGeo("boots", refModel, false); foreach (GearSlot g in Enum.GetValues(typeof(GearSlot))) { updateGearSlotObject(g); } state = ClassState.IDLE; } if (this.animationNif != null) { animationNif.animSpeed = animSpeed; } }
/// <summary> /// Add a file with both video and audio to the timeline. /// </summary> /// <remarks> /// If a file contains both audio and video, this method can be used /// to add the file to both groups at the same time. /// </remarks> /// <para>Video files can be of different /// lengths, frame sizes, color depths, aspect ratios, frame rates, etc. DES /// converts them all to the values specified in the constructor.</para> /// /// <param name="sFileName">A/V file path+name</param> /// <param name="lStart">Start position within the file specified in 100ns units</param> /// <param name="lStop">End position within the file specified in 100ns units /// or -1 to add entire file</param> public void AddAVFile( string sFileName, long lStart, long lStop) { if (m_State > ClassState.FilesAdded) { throw new Exception("Can't add files since rendering method already selected"); } if (!File.Exists(sFileName)) { throw new FileNotFoundException("Can´t add file because its not found at the provided location."); } if (!supportVideo) { throw new NotSupportedException("Can´t add files because this player is initialized without video support."); } if (!supportAudio) { throw new NotSupportedException("Can´t add files because this player is initialized without audio support."); } m_Video.Add(sFileName, lStart, lStop); m_Audio.Add(sFileName, lStart, lStop); // At least one file has now been added m_State = ClassState.FilesAdded; }
/// <summary> /// Construct the class /// </summary> /// <remarks> /// The input files do not need to have the same height/width/fps. DES will /// automatically convert them all to the values specified by the constructor. /// </remarks> /// <param name="FPS">Frames per second (commonly 15 or 30)</param> /// <param name="BitCount">Color depth: 16, 24 or 32</param> /// <param name="Width">Frame width (commonly 320, 640, etc)</param> /// <param name="Height">Frame height (commonly 240, 480, etc)</param> /// <param name="audio">support only audio files</param> /// <param name="video">support only video files</param> public DESCombine(double FPS, short BitCount, int Width, int Height, bool audio, bool video) { threadCompleted = true; // Initialize the data members m_State = ClassState.Constructed; // Create the timeline m_pTimeline = (IAMTimeline) new AMTimeline(); // Set the frames per second int hr = m_pTimeline.SetDefaultFPS(FPS); DESError.ThrowExceptionForHR(hr); supportAudio = audio; supportVideo = video; if (supportVideo) { // Init the video group m_Video = new MediaGroup(GetVideoMediaType(BitCount, Width, Height), m_pTimeline, FPS); } if (supportAudio) { // Init the audio group m_Audio = new MediaGroup(GetAudioMediaType(), m_pTimeline, FPS); } this.ThreadFinished += new EventHandler(DESCombine_ThreadFinished); }
/// <summary> /// Begins rendering and returns immediately. /// </summary> /// <remarks> /// Final status is sent as a <see cref="DESCombine.Completed"/> event. /// </remarks> public void StartRendering() { int hr; if (m_State < ClassState.RenderSelected) { throw new Exception("Render method not selected"); } m_State = ClassState.GraphStarted; m_pControl = (IMediaControl)m_pGraph; // Avoid double threads if (threadCompleted) { // Create a new thread to process events Thread t; t = new Thread(new ThreadStart(EventWait)); t.Name = "Media Event Thread"; t.Start(); threadCompleted = false; } hr = m_pControl.Run(); DESError.ThrowExceptionForHR(hr); }
public void clearGearSlot(GearSlot slot) { gearSlotKeys.Remove(slot); if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
/// <summary> /// eg, "mount" /// </summary> /// <param name="postfix"></param> public void setKFBPostFix(string postfix) { this.kfbPostfix = postfix; if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
/// <summary> /// /// </summary> public void RemoveAudioFiles() { if (m_Audio != null && m_Audio.Count > 0) { m_Audio.RemoveTracks(); } m_State = ClassState.Constructed; }
public void clearAppearence() { gearSlotKeys.Clear(); if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
/// <summary> /// Helps deal with potential conflicts between the eventing thread /// and client calls to Cancel() /// </summary> /// <param name="newState">State to change to</param> private void ChangeState(ClassState newState) { lock (this) { //if (m_State == ClassState.GraphStarted) { m_State = newState; } } }
/// <summary> /// /// </summary> public void StopWhenReady() { if (this.m_pControl != null) { // Stop the graph from playing the media file int hr = this.m_pControl.StopWhenReady(); DsError.ThrowExceptionForHR(hr); this.m_State = ClassState.Stopped; } }
public void setRace(string race) { if (this.raceString.Equals(race)) { return; } this.raceString = race; if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
public void setGender(string gender) { if (this.genderString.Equals(gender)) { return; } this.genderString = gender; if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
public void setGearSlotKey(GearSlot slot, long key) { if (gearSlotKeys.ContainsKey(slot) && gearSlotKeys[slot] == key) { return; } Debug.Log("set gear slot[" + slot + "] to key " + key, gameObject); clearOtherWeapons(slot); gearSlotKeys[slot] = key; if (state == ClassState.IDLE) { state = ClassState.UPDATE; } }
/// <summary> /// Add the audio portion of a file to the timeline. /// </summary> /// <remarks> /// If a file contains both audio and video, this method will only add the audio portion. /// </remarks> /// <param name="sFileName">Audio file path+name</param> /// <param name="lStart">Start position within the file specified in 100ns units</param> public void AddAudioFile( string sFileName, long lStart) { if (m_State > ClassState.FilesAdded) { throw new Exception("Can't add files since rendering method already selected"); } if (!supportAudio) { throw new NotSupportedException("Can´t add files because this player is initialized without audio support."); } m_Audio.Add(sFileName, lStart); // At least one file has now been added m_State = ClassState.FilesAdded; }
public void SetClass(ClassState _class) //클래스 장비 부분 { nowClass = _class; switch (_class) { case ClassState.Guardian: health = gHealth; attack = gAttack; nowGun = Instantiate(gGun, transform); nowShield = Instantiate(shield, transform); break; case ClassState.Surprise: health = sHealth; attack = sAttack; nowGun = Instantiate(sGun, transform); break; } }
/// <summary> /// Pauses / unpauses clip according to state. /// </summary> public void PauseRendering() { if (this.m_pControl == null) { return; } // Toggle play/pause behavior if ((this.m_State == ClassState.Paused) || (this.m_State == ClassState.Stopped)) { if (this.m_pControl.Run() >= 0) { this.m_State = ClassState.Running; } } else { if (this.m_pControl.Pause() >= 0) { this.m_State = ClassState.Paused; } } }
/// <summary> /// Called from RenderTo* routines to perform common initialization /// </summary> private void RenderCommon() { int hr; if (m_State >= ClassState.RenderSelected) { throw new Exception("Graph rendering has already been selected"); } if (m_State < ClassState.FilesAdded) { throw new Exception("No files added to render."); } m_State = ClassState.RenderSelected; // create the render engine m_pRenderEngine = (IRenderEngine) new RenderEngine(); // tell the render engine about the timeline it should use hr = m_pRenderEngine.SetTimelineObject(m_pTimeline); DESError.ThrowExceptionForHR(hr); // connect up the front end hr = m_pRenderEngine.ConnectFrontEnd(); DESError.ThrowExceptionForHR(hr); // Get the filtergraph - used all over the place hr = m_pRenderEngine.GetFilterGraph(out m_pGraph); DESError.ThrowExceptionForHR(hr); #if DEBUG // Allow the graph to be connected to from GraphEdit m_rot = new DsROTEntry(m_pGraph); #endif }
/// <summary> /// Construct the class /// </summary> /// <remarks> /// The input files do not need to have the same height/width/fps. DES will /// automatically convert them all to the values specified by the constructor. /// </remarks> /// <param name="FPS">Frames per second (commonly 15 or 30)</param> /// <param name="BitCount">Color depth: 16, 24 or 32</param> /// <param name="Width">Frame width (commonly 320, 640, etc)</param> /// <param name="Height">Frame height (commonly 240, 480, etc)</param> public DESCombine(double FPS, short BitCount, int Width, int Height) { // Initialize the data members m_State = ClassState.Constructed; // Create the timeline m_pTimeline = (IAMTimeline)new AMTimeline(); // Set the frames per second int hr = m_pTimeline.SetDefaultFPS(FPS); DESError.ThrowExceptionForHR(hr); // Init the video group m_Video = new Group(GetVideoMediaType(BitCount, Width, Height), m_pTimeline, FPS); // Init the audio group m_Audio = new Group(GetAudioMediaType(), m_pTimeline, FPS); }
/// <summary> /// Add a file with both video and audio to the timeline. /// </summary> /// <remarks> /// If a file contains both audio and video, this method can be used /// to add the file to both groups at the same time. /// </remarks> /// <para>Video files can be of different /// lengths, frame sizes, color depths, aspect ratios, frame rates, etc. DES /// converts them all to the values specified in the constructor.</para> /// /// <param name="sFileName">A/V file path+name</param> /// <param name="lStart">Start position within the file specified in 100ns units</param> /// <param name="lStop">End position within the file specified in 100ns units /// or -1 to add entire file</param> public void AddAVFile( string sFileName, long lStart, long lStop) { if (m_State > ClassState.FilesAdded) { throw new Exception("Can't add files since rendering method already selected"); } if (!File.Exists(sFileName)) { throw new FileNotFoundException("Can´t add file because its not found at the provided location."); } if (!supportVideo) { throw new NotSupportedException("Can´t add files because this player is initialized without video support."); } if (!supportAudio) { throw new NotSupportedException("Can´t add files because this player is initialized without audio support."); } m_Video.Add(sFileName, lStart, lStop); m_Audio.Add(sFileName, lStart, lStop); // At least one file has now been added m_State = ClassState.FilesAdded; }
/// <summary> /// /// </summary> public void RemoveAudioFiles() { if (m_Audio != null && m_Audio.Count > 0) { m_Audio.RemoveTracks(); } m_State = ClassState.Constructed; }
/// <summary> /// Add the audio portion of a file to the timeline. /// </summary> /// <remarks> /// If a file contains both audio and video, this method will only add the audio portion. /// </remarks> /// <param name="sFileName">Audio file path+name</param> /// <param name="lStart">Start position within the file specified in 100ns units</param> public void AddAudioFile( string sFileName, long lStart) { if (m_State > ClassState.FilesAdded) { throw new Exception("Can't add files since rendering method already selected"); } if (!supportAudio) { throw new NotSupportedException("Can´t add files because this player is initialized without audio support."); } m_Audio.Add(sFileName, lStart); // At least one file has now been added m_State = ClassState.FilesAdded; }
/// <summary> /// Begins rendering and returns immediately. /// </summary> /// <remarks> /// Final status is sent as a <see cref="DESCombine.Completed"/> event. /// </remarks> public void StartRendering() { int hr; if (m_State < ClassState.RenderSelected) { throw new Exception("Render method not selected"); } m_State = ClassState.GraphStarted; m_pControl = (IMediaControl)m_pGraph; // Avoid double threads if (threadCompleted) { // Create a new thread to process events Thread t; t = new Thread(new ThreadStart(EventWait)); t.Name = "Media Event Thread"; t.Start(); threadCompleted = false; } hr = m_pControl.Run(); DESError.ThrowExceptionForHR(hr); }
/// <summary> /// Pauses / unpauses clip according to state. /// </summary> public void PauseRendering() { if (this.m_pControl == null) return; // Toggle play/pause behavior if ((this.m_State == ClassState.Paused) || (this.m_State == ClassState.Stopped)) { if (this.m_pControl.Run() >= 0) this.m_State = ClassState.Running; } else { if (this.m_pControl.Pause() >= 0) this.m_State = ClassState.Paused; } }
public Class(Type classType, ClassState state) { this.classType = classType; this.state = state; }
private Solution CreateInitialSolution() { const int chunkSize = 256; var hardPenalty = 0; var softPenalty = 0; var classStates = new ClassState[Classes.Length]; var studentStates = new StudentState[Students.Length]; for (var i = 0; i < classStates.Length; i++) { var classData = Classes[i]; classStates[i] = new ClassState( PullOne(classData.PossibleRooms, 1), PullOne(classData.PossibleSchedules, 1), 0, 0, 0, 0); } var totalPenaltyStudent = 0; var totalPenaltyTime = 0; var totalPenaltyRoom = 0; var totalPenaltyDistribution = 0; for (var i = 0; i < studentStates.Length; i++) { var studentData = Students[i]; var enrollmentStates = new List <EnrollmentState>(); var classesSoFar = new List <(Schedule schedule, int room)>(); var conflicts = 0; foreach (var courseId in studentData.Courses) { var course = Courses[courseId]; var chain = course.ClassChains[i % course.ClassChains.Length]; var enrollmentState = new EnrollmentState(chain.ConfigIndex, chain.Indexes); enrollmentStates.Add(enrollmentState); var enrolledSubparts = enrollmentState.Subparts; var config = course.Configurations[chain.ConfigIndex]; for (var j = 0; j < enrolledSubparts.Length; j++) { var subpart = config.Subparts[j]; var classIndex = enrolledSubparts[j]; var classObject = subpart.Classes[classIndex]; var classData = Classes[classObject.Id]; var classState = classStates[classObject.Id]; classStates[classObject.Id] = classState = classState .WithAttendees(classState.Attendees + 1, 0, 0); var schedule = classData.PossibleSchedules[classState.Time]; var room = classState.Room >= 0 ? classData.PossibleRooms[classState.Room].Id : -1; foreach (var(prevSchedule, prevRoom) in classesSoFar) { var travelTime = room >= 0 && prevRoom >= 0 ? TravelTimes[room, prevRoom] : 0; if (schedule.Overlaps(prevSchedule, travelTime)) { conflicts++; } } classesSoFar.Add((schedule, room)); } } softPenalty += conflicts * StudentPenalty; totalPenaltyStudent += conflicts; studentStates[i] = new StudentState(enrollmentStates.ToArray(), conflicts); } var classConflicts = 0; var roomsUnavailable = 0; var classOverflows = 0; for (var i = 0; i < classStates.Length; i++) { var state = classStates[i]; var classData = Classes[i]; var schedule = classData.PossibleSchedules[state.Time]; softPenalty += TimePenalty * schedule.Penalty; totalPenaltyTime += schedule.Penalty; var roomId = -1; var roomCapacityPenalty = 0; var roomUnavailablePenalty = 0; var classCapacityPenalty = state.Attendees > classData.Capacity ? Solution.ClassCapacityOverflowBase + (state.Attendees - classData.Capacity) / Solution.ClassCapacityOverflowRate : 0; classOverflows += classCapacityPenalty; if (state.Room >= 0) { var roomAssignment = classData.PossibleRooms[state.Room]; roomId = roomAssignment.Id; var room = Rooms[roomId]; roomCapacityPenalty = state.Attendees > room.Capacity ? Solution.RoomCapacityOverflowBase + (state.Attendees - room.Capacity) / Solution.RoomCapacityOverflowRate : 0; hardPenalty += roomCapacityPenalty; roomUnavailablePenalty = 0; foreach (var unavailableSchedule in room.UnavailableSchedules) { if (schedule.Overlaps(unavailableSchedule)) { roomUnavailablePenalty = 1; break; } } hardPenalty += roomUnavailablePenalty; roomsUnavailable += roomUnavailablePenalty; softPenalty += RoomPenalty * roomAssignment.Penalty; totalPenaltyRoom += roomAssignment.Penalty; } for (var j = 0; j < i; j++) { var otherClassState = classStates[j]; var otherClassData = Classes[j]; if (otherClassState.Room < 0) { continue; } var otherRoomId = otherClassData.PossibleRooms[otherClassState.Room].Id; if (roomId != otherRoomId) { continue; } var otherSchedule = otherClassData.PossibleSchedules[otherClassState.Time]; if (schedule.Overlaps(otherSchedule)) { classConflicts++; } } classStates[i] = new ClassState( state.Room, state.Time, state.Attendees, classCapacityPenalty, roomCapacityPenalty, roomUnavailablePenalty); } hardPenalty += classConflicts; var constraintStates = new ConstraintState[Constraints.Length]; var partialSolution = new Solution( this, hardPenalty, softPenalty, classOverflows, classConflicts, roomsUnavailable, new ChunkedArray <ClassState>(classStates, chunkSize), new ChunkedArray <StudentState>(studentStates, chunkSize), new ChunkedArray <ConstraintState>(constraintStates, chunkSize)); foreach (var constraint in Constraints) { var(h, s) = constraint.Evaluate(this, partialSolution); var normalized = (constraint.Required ? (double)h : s) / constraint.WorstCase; constraintStates[constraint.Id] = new ConstraintState(h, s, normalized); hardPenalty += h; softPenalty += s * DistributionPenalty; totalPenaltyDistribution += s; } var initialSolution = new Solution( this, hardPenalty, softPenalty, classOverflows, classConflicts, roomsUnavailable, new ChunkedArray <ClassState>(classStates, chunkSize), new ChunkedArray <StudentState>(studentStates, chunkSize), new ChunkedArray <ConstraintState>(constraintStates, chunkSize)); return(initialSolution); }
/// <summary> /// /// </summary> public void StopWhenReady() { if (this.m_pControl != null) { // Stop the graph from playing the media file int hr = this.m_pControl.StopWhenReady(); DsError.ThrowExceptionForHR(hr); this.m_State = ClassState.Stopped; } }
/// <summary> /// Helps deal with potential conflicts between the eventing thread /// and client calls to Cancel() /// </summary> /// <param name="newState">State to change to</param> private void ChangeState(ClassState newState) { lock (this) { //if (m_State == ClassState.GraphStarted) { m_State = newState; } } }
/// <summary> /// Called on a new thread to process events from the graph. The thread /// exits when the graph finishes. Cancelling is done here. /// </summary> private void EventWait() { // Returned when GetEvent is called but there are no events const int E_ABORT = unchecked((int)0x80004004); int hr; IntPtr p1, p2; EventCode ec; EventCode exitCode = 0; IMediaEvent pEvent = (IMediaEvent)m_pGraph; do { // Read the event for ( hr = pEvent.GetEvent(out ec, out p1, out p2, 100); hr >= 0 && m_State < ClassState.GraphCompleted; hr = pEvent.GetEvent(out ec, out p1, out p2, 100) ) { switch (ec) { case EventCode.UserAbort: ChangeState(ClassState.Cancelling); exitCode = ec; // Release any resources the message allocated hr = pEvent.FreeEventParams(ec, p1, p2); DESError.ThrowExceptionForHR(hr); break; // If the clip is finished playing case EventCode.Complete: case EventCode.ErrorAbort: ChangeState(ClassState.GraphCompleting); exitCode = ec; // Release any resources the message allocated hr = pEvent.FreeEventParams(ec, p1, p2); DESError.ThrowExceptionForHR(hr); break; // Walked past the end of a video file, send an event case EC_VideoFileComplete: if (FileCompleted != null) { MediaFile mf = m_Video.File(p1.ToInt32()); FileCompletedArgs ca = new FileCompletedArgs(mf.FileName, FileCompletedArgs.FileType.Video); FileCompleted(this, ca); } break; // Walked past the end of a video file, send an event case EC_AudioFileComplete: if (FileCompleted != null) { MediaFile mf = m_Audio.File(p1.ToInt32()); FileCompletedArgs ca = new FileCompletedArgs(mf.FileName, FileCompletedArgs.FileType.Audio); FileCompleted(this, ca); } break; default: // Release any resources the message allocated hr = pEvent.FreeEventParams(ec, p1, p2); DESError.ThrowExceptionForHR(hr); break; } } // If the error that exited the loop wasn't due to running out of events if (hr != E_ABORT) { DESError.ThrowExceptionForHR(hr); } //FilterState fs; //m_pControl.GetState(200, out fs); ////DESError.ThrowExceptionForHR(hr); } while (m_State < ClassState.GraphCompleting); // If the user cancelled if (m_State == ClassState.Cancelling && m_pControl != null) { // Stop the graph, send an appropriate exit code hr = m_pControl.Stop(); exitCode = EventCode.UserAbort; } if (m_State == ClassState.GraphCompleting) { m_State = ClassState.GraphCompleted; } else { m_State = ClassState.Cancelled; } threadCompleted = true; // Send an event saying we are complete if (this.ThreadFinished != null) { DESCompletedArgs ca = new DESCompletedArgs(exitCode); this.ThreadFinished(this, ca); } } // Exit the thread
/// <summary> /// Construct the class /// </summary> /// <remarks> /// The input files do not need to have the same height/width/fps. DES will /// automatically convert them all to the values specified by the constructor. /// </remarks> /// <param name="FPS">Frames per second (commonly 15 or 30)</param> /// <param name="BitCount">Color depth: 16, 24 or 32</param> /// <param name="Width">Frame width (commonly 320, 640, etc)</param> /// <param name="Height">Frame height (commonly 240, 480, etc)</param> /// <param name="audio">support only audio files</param> /// <param name="video">support only video files</param> public DESCombine(double FPS, short BitCount, int Width, int Height, bool audio, bool video) { threadCompleted = true; // Initialize the data members m_State = ClassState.Constructed; // Create the timeline m_pTimeline = (IAMTimeline)new AMTimeline(); // Set the frames per second int hr = m_pTimeline.SetDefaultFPS(FPS); DESError.ThrowExceptionForHR(hr); supportAudio = audio; supportVideo = video; if (supportVideo) { // Init the video group m_Video = new MediaGroup(GetVideoMediaType(BitCount, Width, Height), m_pTimeline, FPS); } if (supportAudio) { // Init the audio group m_Audio = new MediaGroup(GetAudioMediaType(), m_pTimeline, FPS); } this.ThreadFinished += new EventHandler(DESCombine_ThreadFinished); }
/// <summary> /// Called on a new thread to process events from the graph. The thread /// exits when the graph finishes. Cancelling is done here. /// </summary> private void EventWait() { // Returned when GetEvent is called but there are no events const int E_ABORT = unchecked ((int)0x80004004); int hr; IntPtr p1, p2; EventCode ec; EventCode exitCode = 0; IMediaEvent pEvent = (IMediaEvent)m_pGraph; do { // Read the event for ( hr = pEvent.GetEvent(out ec, out p1, out p2, 100); hr >= 0 && m_State < ClassState.GraphCompleted; hr = pEvent.GetEvent(out ec, out p1, out p2, 100) ) { switch (ec) { case EventCode.UserAbort: ChangeState(ClassState.Cancelling); exitCode = ec; // Release any resources the message allocated hr = pEvent.FreeEventParams(ec, p1, p2); DESError.ThrowExceptionForHR(hr); break; // If the clip is finished playing case EventCode.Complete: case EventCode.ErrorAbort: ChangeState(ClassState.GraphCompleting); exitCode = ec; // Release any resources the message allocated hr = pEvent.FreeEventParams(ec, p1, p2); DESError.ThrowExceptionForHR(hr); break; // Walked past the end of a video file, send an event case EC_VideoFileComplete: if (FileCompleted != null) { MediaFile mf = m_Video.File(p1.ToInt32()); FileCompletedArgs ca = new FileCompletedArgs(mf.FileName, FileCompletedArgs.FileType.Video); FileCompleted(this, ca); } break; // Walked past the end of a video file, send an event case EC_AudioFileComplete: if (FileCompleted != null) { MediaFile mf = m_Audio.File(p1.ToInt32()); FileCompletedArgs ca = new FileCompletedArgs(mf.FileName, FileCompletedArgs.FileType.Audio); FileCompleted(this, ca); } break; default: // Release any resources the message allocated hr = pEvent.FreeEventParams(ec, p1, p2); DESError.ThrowExceptionForHR(hr); break; } } // If the error that exited the loop wasn't due to running out of events if (hr != E_ABORT) { DESError.ThrowExceptionForHR(hr); } //FilterState fs; //m_pControl.GetState(200, out fs); ////DESError.ThrowExceptionForHR(hr); } while (m_State < ClassState.GraphCompleting); // If the user cancelled if (m_State == ClassState.Cancelling && m_pControl != null) { // Stop the graph, send an appropriate exit code hr = m_pControl.Stop(); exitCode = EventCode.UserAbort; } if (m_State == ClassState.GraphCompleting) { m_State = ClassState.GraphCompleted; } else { m_State = ClassState.Cancelled; } threadCompleted = true; // Send an event saying we are complete if (this.ThreadFinished != null) { DESCompletedArgs ca = new DESCompletedArgs(exitCode); this.ThreadFinished(this, ca); } } // Exit the thread
/// <summary> /// Called from RenderTo* routines to perform common initialization /// </summary> private void RenderCommon() { int hr; if (m_State >= ClassState.RenderSelected) { throw new Exception("Graph rendering has already been selected"); } if (m_State < ClassState.FilesAdded) { throw new Exception("No files added to render."); } m_State = ClassState.RenderSelected; // create the render engine m_pRenderEngine = (IRenderEngine)new RenderEngine(); // tell the render engine about the timeline it should use hr = m_pRenderEngine.SetTimelineObject(m_pTimeline); DESError.ThrowExceptionForHR(hr); // connect up the front end hr = m_pRenderEngine.ConnectFrontEnd(); DESError.ThrowExceptionForHR(hr); // Get the filtergraph - used all over the place hr = m_pRenderEngine.GetFilterGraph(out m_pGraph); DESError.ThrowExceptionForHR(hr); #if DEBUG // Allow the graph to be connected to from GraphEdit m_rot = new DsROTEntry(m_pGraph); #endif }
//long appearenceSet = long.MinValue; public Paperdoll() : base() { DBInst.loadOrCallback((d) => state = ClassState.UPDATE); }
void Update() { float horizontal = Input.GetAxis("Horizontal") * speed * Time.deltaTime; float vertical = Input.GetAxis("Vertical") * speed * Time.deltaTime; transform.Translate(horizontal, vertical, 0); if (Mathf.Abs(horizontal) < 0.001) { animator.SetInteger("SpeedX", 0); } else if (horizontal > 0) { animator.SetInteger("SpeedX", 1); } else { animator.SetInteger("SpeedX", -1); } if (Mathf.Abs(vertical) < 0.001) { animator.SetInteger("SpeedY", 0); } else if (vertical > 0) { animator.SetInteger("SpeedY", 1); } else { animator.SetInteger("SpeedY", -1); } if (Input.GetKeyDown(KeyCode.Alpha1)) { spriteRenderer.sprite = warriorSprite; currClassState = ClassState.Warrior; } else if (Input.GetKeyDown(KeyCode.Alpha2)) { spriteRenderer.sprite = archerSprite; currClassState = ClassState.Archer; } else if (Input.GetKeyDown(KeyCode.Alpha3)) { spriteRenderer.sprite = mageSprite; currClassState = ClassState.Mage; } else if (Input.GetMouseButtonDown(0)) { switch (currClassState) { case ClassState.Warrior: Debug.Log("Attacked with warrior primary"); break; case ClassState.Archer: Debug.Log("Attacked with archer primary"); break; case ClassState.Mage: Debug.Log("Attacked with mage primary"); break; } } else if (Input.GetMouseButtonDown(1)) { switch (currClassState) { case ClassState.Warrior: Debug.Log("Attacked with warrior secondary"); break; case ClassState.Archer: Debug.Log("Attacked with archer secondary"); break; case ClassState.Mage: Debug.Log("Attacked with mage secondary"); break; } } }