public static byte[] PokerPeeperOfSeat(this PlayingData playingData, int seat) { if (playingData == null) { return(null); } switch (seat) { case 0: return(playingData.poker_peeper1); case 1: return(playingData.poker_peeper2); case 2: return(playingData.poker_peeper3); case 3: return(playingData.poker_peeper4); default: return(null); } }
void _UpdatePlayingSpeech() { if (this.speechAudioClip != null || !string.IsNullOrEmpty(this.speechMorphText)) { PlayingData playingData = _ParsePlayingData(this.speechAudioClip, this.speechMorphText); this.speechAudioClip = null; this.speechMorphText = ""; _playingDataList.Clear(); _playingPos = 0; if (_isPlayingAudioClip) { _isPlayingAudioClip = false; if (_audioSource != null) { _audioSource.Stop(); _audioSource.clip = null; } } if (playingData != null) { _playingDataList.Add(playingData); } } }
void ClearAndGotoStageSelect() { PlayingData.UpdateClearTime(PlayingData.StageIndex, moveTime); fade.StartFade(true, () => { SceneManager.LoadScene("StageSelect"); }, 2.5f); }
public void DrawNote(Graphics g, PlayingData pd, Note n, object color = null, int dx = 0, int dy = 0) { Color c; if (color == null) { switch (n.type) {//set color for default case NoteType.ShortNote: c = Color.White; break; case NoteType.SlideLongNote: c = Color.GreenYellow; break; default: c = Color.Red; break; } } else { c = (Color)color; } g.DrawRectangle(new Pen(c, 2), MusicMath.RectFromNote(n, pd, dx, dy)); }
public static int LeftPokerCountOfSeat(this PlayingData playingData, int seat) { if (playingData == null) { return(32); } switch (seat) { case 0: return(playingData.left_count1); case 1: return(playingData.left_count2); case 2: return(playingData.left_count3); case 3: return(playingData.left_count4); default: return(32); } }
public static PokerPattern LastChuPaiOfSeat(this PlayingData playingData, int seat) { if (playingData == null) { return(null); } switch (seat) { case 0: return(playingData.last_chupai1); case 1: return(playingData.last_chupai2); case 2: return(playingData.last_chupai3); case 3: return(playingData.last_chupai4); default: return(null); } }
public void ResultPanelOKButtonClick(int id) { string a = DataCollection.GetInstance().GetPlayerData(); m_eventHandlerGameClass.EventUploadData(a); // DataCollection.GetInstance().SavePlayerData(); DataCollection.GetInstance().SaveMapData(PlayingData.GetInstance().m_mapData); SceneManager.LoadScene(id); }
protected override void DoHandle(StartRound msg) { var msgPlayingData = msg.playing_data; if (msgPlayingData != null) { _playingData.Write(msgPlayingData, Time.time); } var table = _currentTable.Read(); if (table != null) { // 开局刷新一下局数和HostInfo。 table.team1_host = msg.team1_host; table.team2_host = msg.team2_host; table.host_team = msg.host_team; table.round_count = msg.round_count; // 刷新桌面用户的数据。这里已经更新了MyUser DataUtil.UpdateUserPublic(msg.user1, table.user1); DataUtil.UpdateUserPublic(msg.user2, table.user2); DataUtil.UpdateUserPublic(msg.user3, table.user3); DataUtil.UpdateUserPublic(msg.user4, table.user4); _myUser.Invalidate(Time.time); // 更新桌子数据。 // 可以刷新游戏的状态。 _currentTable.Invalidate(Time.time); // 重置打牌数据。 var playingData = _playingData.Read(); if (playingData == null) { playingData = new PlayingData(); playingData.ResetAll(); playingData.period = TablePeriod.StartRound; _playingData.Write(playingData, Time.time); } //清空团团转数据 _ttzStartBroadcast.ClearAndInvalidate(0); // 开局的时候清空结算数据。 _bRoundEnd.ClearNotInvalidate(); _raceRoundEnd.ClearNotInvalidate(); // 设置开局时间。 _startRound.Write(msg, Time.time); //清空倒计时时间 _bCounter.ClearAndInvalidate(0); _kickOutCounter.ClearAndInvalidate(0); } }
public void DrawNotes(Graphics g, PlayingData pd, List <Note> notes) { foreach (Note n in notes) { if ((pd.now <= n.timing) && (n.timing <= pd.now + pd.scale)) { DrawNote(g, pd, n); } } }
void UpdateExplanations() { var index = PlayingData.StageIndex; var stageData = PlayingData.StageDatas[index]; var clearTime = PlayingData.GetClearTime(PlayingData.StageIndex); var clearTimeText = clearTime == 0 ? "未達成" : "最高記録 " + TatamiUtil.Int2Japanese(clearTime) + "回"; StageNameText.text = TatamiUtil.Int2Japanese(index) + " " + stageData.Name; ExplanationText.text = clearTimeText + "\n" + stageData.Explanation; }
public void ShowResultPanel() { m_resultPanel.SetActive(true); m_results[0].text = m_timer.ToString("0.00") + "s"; m_results[1].text = PlayingData.GetInstance().GetResultBy("PathNodeMoveLeft"); m_results[2].text = PlayingData.GetInstance().GetResultBy("PathNodeMoveRight"); m_results[3].text = PlayingData.GetInstance().GetResultBy("PathNodeMoveUp"); m_results[4].text = PlayingData.GetInstance().GetResultBy("PathNodeMoveDown"); m_results[5].text = PlayingData.GetInstance().GetResultBy("PathNodeRotateLeft"); m_results[6].text = PlayingData.GetInstance().GetResultBy("PathNodeRotateRight"); m_results[7].text = PlayingData.GetInstance().GetResultBy("PathNodeSeaweed"); m_results[8].text = PlayingData.GetInstance().GetResultBy("PathNodeSpeedup"); }
void Update() { if (goingToScene || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Z)) { GotoProblemScene(); return; } if (Input.GetKeyDown(KeyCode.I) && Input.GetKey(KeyCode.LeftShift)) { PlayingData.DeleteClearTimeAll(); Debug.Log("DELETE CLEAR TIME"); } StageSelectByUserCommand(); }
public void DrawImaginaryNote(Graphics g, PlayingData pd, Note DraggingNote, Note SelectedNote, bool dragging, Point draggingDelta) { //draw dragging note ///todo: draggingnote delta beat if (dragging) { DrawNote(g, pd, DraggingNote, Color.Gray, draggingDelta.X, draggingDelta.Y); } //draw selected note if (SelectedNote != null) { g.DrawRectangle(new Pen(Color.Yellow, 1), MusicMath.RectFromNote(SelectedNote, pd)); } }
public static void ResetAll(this PlayingData playingData) { if (playingData == null) { return; } // 清空当前的出牌座位。 playingData.chupai_key_owner_seat = -1; playingData.chupai_key = null; playingData.left_time = 0; playingData.must_chupai = 2; playingData.my_pokers = null; // 清空剩余牌数。 playingData.left_count1 = 32; playingData.left_count2 = 32; playingData.left_count3 = 32; playingData.left_count4 = 32; // 开局的时候清空出牌记录。 playingData.last_chupai1 = null; playingData.last_chupai2 = null; playingData.last_chupai3 = null; playingData.last_chupai4 = null; playingData.win_level = 0; // 清空进贡还贡信息。 playingData.jg_seat1 = -1; playingData.jg_poker1 = -1; playingData.jg_dest1 = -1; playingData.jg_seat2 = -1; playingData.jg_poker2 = -1; playingData.jg_dest2 = -1; playingData.hg_seat1 = -1; playingData.hg_poker1 = -1; playingData.hg_dest1 = -1; playingData.hg_seat2 = -1; playingData.hg_poker2 = -1; playingData.hg_dest2 = -1; // 重置翻倍数据。 playingData.fanbei = 1; }
}//*/ public void DrawGuideLine(Graphics g, PlayingData pd) { Pen borderlinedrawer = new Pen(Color.White, 0.5f); for (int i = 0; i < pd.hsnapcnt; i++)//Horizontal guideline { int x = this.Width * (i + 1) / ((int)pd.hsnapcnt + 1); g.DrawLine(borderlinedrawer, x, 0, x, this.Height); }//Horizontal guideline int beat = ((int)(pd.now * 48 / pd.bsnapcnt)) * pd.bsnapcnt; double l = beat / 48d; while (beat < 0) { beat += 48; } for (; l < pd.now + pd.scale; l += 1d / 48d) { Pen linedrawer; beat %= 48;//detect beat if (beat % (48 / pd.bsnapcnt) != 0) { beat++; continue; } if (beat == 0 && ((l + 12.1) % 4) < 0.4)//thick line every large beat(4 small beat) { linedrawer = new Pen(Editor.BeatSnapColor.col[beat], 3); } else { linedrawer = new Pen(Editor.BeatSnapColor.col[beat], 1); } int y = MusicMath.TimingToY(l, pd); g.DrawLine(linedrawer, 0, y, pd.width, y); beat++; }//vertical(beat)guideline }
PlayingData _ParsePlayingData(AudioClip audioClip, string morphText) { PlayingData playingData = new PlayingData(); playingData.audioClip = audioClip; playingData.playingLength = 0.0f; playingData.playingTime = 0.0f; playingData.morphPos = -1; playingData.morphTime = 0.0f; if (!string.IsNullOrEmpty(morphText)) { playingData.morphDataList = _ParseMorphText(morphText); } else { playingData.morphDataList = _ParseMorphText(System.IO.Path.GetFileNameWithoutExtension(audioClip.name)); } if (playingData.morphDataList != null) { float morphTotalLength = 0.0f; int morphZeroCount = 0; for (int i = 0; i < playingData.morphDataList.Count; ++i) { char ch = playingData.morphDataList[i].morphChar; if (playingData.morphDataList[i].morphLength == 0.0f) { if (ch != '^' && ch != '`') { ++morphZeroCount; } } else { morphTotalLength += playingData.morphDataList[i].morphLength; } } float elementLength = GetElementLength(); if (audioClip != null) { playingData.playingLength = audioClip.length; if (playingData.playingLength <= morphTotalLength) { playingData.playingLength = morphTotalLength; elementLength = 0.0f; } else { if (morphZeroCount > 0) { elementLength = (playingData.playingLength - morphTotalLength) / (float)morphZeroCount; } } } else { playingData.playingLength = morphTotalLength + elementLength * (float)morphZeroCount; } if (elementLength > 0.0f) { // Allocate each morphLength. for (int i = 0; i < playingData.morphDataList.Count; ++i) { char ch = playingData.morphDataList[i].morphChar; if (playingData.morphDataList[i].morphLength == 0.0f) { if (ch != '^' && ch != '`') { MorphData morphData = playingData.morphDataList[i]; morphData.morphLength = elementLength; playingData.morphDataList[i] = morphData; } } } // Fix for each consonantLength. float consonantLength = GetConsonantLength(); for (int i = 0; i < playingData.morphDataList.Count; ++i) { char ch = playingData.morphDataList[i].morphChar; if (playingData.morphDataList[i].morphLength == 0.0f) { if (ch != '^' && ch != '`') { // Nothing. } else { int beginIndex = i; for (++i; i < playingData.morphDataList.Count; ++i) { ch = playingData.morphDataList[i].morphChar; if (ch != '^' && ch != '`') { float morphLength = playingData.morphDataList[i].morphLength; float tempLength = 0.0f; if (consonantLength * 2.0f <= morphLength) { MorphData morphData = playingData.morphDataList[i]; morphData.morphLength = morphLength - consonantLength; playingData.morphDataList[i] = morphData; tempLength = consonantLength; } else { MorphData morphData = playingData.morphDataList[i]; morphData.morphLength = morphLength * 0.5f; playingData.morphDataList[i] = morphData; tempLength = morphData.morphLength; } { MorphData morphData = playingData.morphDataList[beginIndex]; morphData.morphLength = tempLength; playingData.morphDataList[beginIndex] = morphData; } break; } else { if (playingData.morphDataList[i].morphLength == 0.0f) { // Nothing. } else { break; // Skip processing.( Exception case, no effects. ) } } } } } } } } else { if (audioClip != null) { playingData.playingLength = audioClip.length; } } #if false if (playingData.morphDataList != null) { for (int i = 0; i < playingData.morphDataList.Count; ++i) { Debug.Log("" + playingData.morphDataList[i].morphName + ":" + playingData.morphDataList[i].morphChar + ":" + playingData.morphDataList[i].morphLength); } } #endif return(playingData); }
public void DrawLongNotes(Graphics g, PlayingData pd, List <Note> notes) { }
void _UpdateSpeech(float deltaTime) { _UpdatePlayingSpeech(); if (_playingDataList == null || _playingDataList.Count == 0) { return; } if (_playingPos >= _playingDataList.Count) { if (_isPlayingAudioClip) { _isPlayingAudioClip = false; if (_audioSource != null) { _audioSource.Stop(); _audioSource.clip = null; } } if (_isPlayingMorph) { _isPlayingMorph = false; base.morphName = ""; base.morphWeight = 0.0f; } _playingDataList.Clear(); _playingPos = 0; return; } PlayingData playingData = _playingDataList[_playingPos]; while (playingData.playingTime >= playingData.playingLength) { if (_isPlayingAudioClip) { _isPlayingAudioClip = false; if (_audioSource != null) { _audioSource.Stop(); _audioSource.clip = null; } } float paddingTime = playingData.playingTime - playingData.playingLength; if (++_playingPos >= _playingDataList.Count) { if (_isPlayingMorph) { _isPlayingMorph = false; base.morphName = ""; base.morphWeight = 0.0f; } return; } playingData = _playingDataList[_playingPos]; playingData.playingTime = paddingTime; } if (playingData.morphPos < 0) { playingData.morphPos = 0; if (playingData.audioClip != null) { _isPlayingAudioClip = true; if (_audioSource != null) { _audioSource.clip = playingData.audioClip; _audioSource.Play(); } } if (playingData.morphDataList != null && playingData.morphPos < playingData.morphDataList.Count) { _isPlayingMorph = true; _UpdateMorph(playingData.morphDataList[playingData.morphPos].morphName); } else { if (_isPlayingMorph) { _isPlayingMorph = false; base.morphName = ""; base.morphWeight = 0.0f; } } } bool overrayPlayingTime = false; if (_isPlayingAudioClip) { if (_audioSource != null) { if (_audioSource.isPlaying) { playingData.playingTime = _audioSource.time; overrayPlayingTime = true; } else { if (playingData.playingTime < playingData.playingLength) { playingData.playingTime = playingData.playingLength; overrayPlayingTime = true; } } } } if (playingData.morphTime < playingData.playingTime) { if (playingData.morphDataList != null) { float addingTime = playingData.playingTime - playingData.morphTime; int beforePos = playingData.morphPos; for ( ; playingData.morphPos < playingData.morphDataList.Count; ++playingData.morphPos) { float morphLength = playingData.morphDataList[playingData.morphPos].morphLength; if (morphLength >= addingTime) { break; } playingData.morphTime += morphLength; addingTime -= morphLength; } if (beforePos != playingData.morphPos && playingData.morphPos < playingData.morphDataList.Count) { _UpdateMorph(playingData.morphDataList[playingData.morphPos].morphName); } } } if (!overrayPlayingTime) { playingData.playingTime += deltaTime; } }
void Awake() { PlayingData.ReadAll(); }