public override void SetEffect <Type>(Type T) { if (typeof(Type) != typeof(PlayPosition)) { return; } PlayPosition pos = (PlayPosition)(object)T; switch (pos) { case PlayPosition.PLAY_LEFT: SetAudioClip(clipController_Left); break; case PlayPosition.PLAY_RIGHT: SetAudioClip(clipController_Right); break; case PlayPosition.PLAY_DOWN: SetAudioClip(clipController_Down); break; case PlayPosition.PLAY_UP: SetAudioClip(clipController_Up); break; default: break; } }
public void SkipTo(PlayPosition position) { if (this.animation == null || this.animationState == null) { return; } switch (position) { case PlayPosition.End: switch (this.startDirection) { case PlayDirection.Forward: if (module != null) { this.module.animTime = 1f; } this.animationState.normalizedTime = 1f; this.animationState.speed = 1f; this.animation.Play(this.stateName); break; case PlayDirection.Backward: if (module != null) { this.module.animTime = 0f; } this.animationState.normalizedTime = 0f; this.animationState.speed = -1f; this.animation.Play(this.stateName); break; } break; case PlayPosition.Beginning: switch (this.startDirection) { case PlayDirection.Backward: if (module != null) { this.module.animTime = 1f; } this.animationState.normalizedTime = 1f; this.animationState.speed = 1f; this.animation.Play(this.stateName); break; case PlayDirection.Forward: if (module != null) { this.module.animTime = 0f; } this.animationState.normalizedTime = 0f; this.animationState.speed = -1f; this.animation.Play(this.stateName); break; } break; } }
//User play event from board control private void BoardCtrl_UserPlayEvent(PlayPosition playPos) { GameResult result = _gameController.UserPlay(playPos); //Show result ctrlDisplayBoard.displayResult(result); ctrlPlayers.showGameScore(result); //if 2nd player is a computer if (_gameController.gameType == GameType.Single && !result.GameOver) { //Introduce a delay bewteen first player play and computer play for smooth user experience Thread.Sleep(400); //DO 2nd computer play result = _gameController.DoComputerPlay(); if (result.LastPlayedPosition != null) { ctrlDisplayBoard.displayResult(result); ctrlPlayers.showGameScore(result); } } //If game over then set board for next play if (result.GameOver) { result = _gameController.ClearBoard(); ctrlDisplayBoard.displayResult(result); ctrlPlayers.showGameScore(result); } }
private void button_Click(object sender, EventArgs e) { PlayPosition pos = this.getPlayPosition((Control)sender); //Raise Play event UserPlayEvent(pos); }
override protected void Awake() { if (triggerEvent == EventType.OnDestroy && position == PlayPosition.ChildObject) { position = PlayPosition.ObjectPosition; Debug.LogWarning("OnDestroy event can not be used with ChildObject"); } base.Awake(); }
public PlayPosition getPlayPosition(Control sender) { PlayPosition playPos = new PlayPosition(); int controlNumber = 0; controlNumber = int.Parse(sender.Name.Substring(1)); controlNumber--; playPos.X = controlNumber / 3; playPos.Y = controlNumber % 3; return(playPos); }
public override string ToString() { StringBuilder sb = new StringBuilder("PlayAudioFrameConfig("); sb.Append("AudioSource: "); sb.Append(AudioSource); sb.Append(",IsLoop: "); sb.Append(IsLoop); sb.Append(",IsAttach: "); sb.Append(IsAttach); sb.Append(",PlayPosition: "); sb.Append(PlayPosition == null ? "<null>" : PlayPosition.ToString()); sb.Append(",EntityType: "); sb.Append(EntityType); sb.Append(",AttachNpcId: "); sb.Append(AttachNpcId); sb.Append(",IsCareGender: "); sb.Append(IsCareGender); sb.Append(",ParamAudioSource: "); sb.Append(ParamAudioSource); sb.Append(")"); return(sb.ToString()); }
public void SkipTo(PlayPosition position) { if (this.animation == null || this.animationState == null) { return; } switch (position) { case PlayPosition.End: switch (this.startDirection) { case PlayDirection.Forward: if (module != null) this.module.animTime = 1f; this.animationState.normalizedTime = 1f; this.animationState.speed = 1f; this.animation.Play(this.stateName); break; case PlayDirection.Backward: if (module != null) this.module.animTime = 0f; this.animationState.normalizedTime = 0f; this.animationState.speed = -1f; this.animation.Play(this.stateName); break; } break; case PlayPosition.Beginning: switch (this.startDirection) { case PlayDirection.Backward: if (module != null) this.module.animTime = 1f; this.animationState.normalizedTime = 1f; this.animationState.speed = 1f; this.animation.Play(this.stateName); break; case PlayDirection.Forward: if (module != null) this.module.animTime = 0f; this.animationState.normalizedTime = 0f; this.animationState.speed = -1f; this.animation.Play(this.stateName); break; } break; } }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("PlayAudioFrameConfig"); oprot.WriteStructBegin(struc); TField field = new TField(); if (AudioSource != null && __isset.audioSource) { field.Name = "audioSource"; field.Type = TType.String; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteString(AudioSource); oprot.WriteFieldEnd(); } if (__isset.isLoop) { field.Name = "isLoop"; field.Type = TType.Bool; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteBool(IsLoop); oprot.WriteFieldEnd(); } if (__isset.isAttach) { field.Name = "isAttach"; field.Type = TType.Bool; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteBool(IsAttach); oprot.WriteFieldEnd(); } if (PlayPosition != null && __isset.playPosition) { field.Name = "playPosition"; field.Type = TType.Struct; field.ID = 4; oprot.WriteFieldBegin(field); PlayPosition.Write(oprot); oprot.WriteFieldEnd(); } if (__isset.entityType) { field.Name = "entityType"; field.Type = TType.I32; field.ID = 5; oprot.WriteFieldBegin(field); oprot.WriteI32((int)EntityType); oprot.WriteFieldEnd(); } if (__isset.attachNpcId) { field.Name = "attachNpcId"; field.Type = TType.I32; field.ID = 6; oprot.WriteFieldBegin(field); oprot.WriteI32(AttachNpcId); oprot.WriteFieldEnd(); } if (__isset.isCareGender) { field.Name = "isCareGender"; field.Type = TType.Bool; field.ID = 7; oprot.WriteFieldBegin(field); oprot.WriteBool(IsCareGender); oprot.WriteFieldEnd(); } if (ParamAudioSource != null && __isset.paramAudioSource) { field.Name = "paramAudioSource"; field.Type = TType.String; field.ID = 8; oprot.WriteFieldBegin(field); oprot.WriteString(ParamAudioSource); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }