public bool SetBgm(TrackName name) { if (bgm == null || bgm.name != name) { bgm = new Bgm(name); bgm.Attach(gameObject); return(true); } return(false); }
private MusicTrack forName(TrackName name) { foreach (MusicTrack track in tracks) { if (track.name == name) { return(track); } } return(forName(defaultTrack)); }
public void Save() { SQLiteDatabase sqlDatabase = null; try { Globals dbHelp = new Globals(); dbHelp.OpenDatabase(); sqlDatabase = dbHelp.GetSQLiteDatabase(); if (sqlDatabase != null) { if (sqlDatabase.IsOpen) { ContentValues values = new ContentValues(); values.Put("PlayListID", PlayListID); values.Put("TrackName", TrackName.Trim()); values.Put("TrackArtist", TrackArtist.Trim()); values.Put("TrackDuration", TrackDuration); values.Put("TrackOrderNumber", TrackOrderNumber); values.Put("TrackUri", TrackUri.Trim()); if (IsNew) { TrackID = (int)sqlDatabase.Insert("Tracks", null, values); IsNew = false; IsDirty = false; } if (IsDirty) { string whereClause = "TrackID = ?"; sqlDatabase.Update("Tracks", values, whereClause, new string[] { TrackID.ToString() }); IsDirty = false; } sqlDatabase.Close(); } } } catch (Exception e) { Log.Error(TAG, "Save: Exception - " + e.Message); if (sqlDatabase != null && sqlDatabase.IsOpen) { sqlDatabase.Close(); } } }
public override int GetHashCode() { unchecked { var hashCode = TrackName != null?TrackName.GetHashCode() : 0; hashCode = (hashCode * 397) ^ Duration; hashCode = (hashCode * 397) ^ Bitrate; hashCode = (hashCode * 397) ^ (TrackUrl != null ? TrackUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Group != null ? Group.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Year; hashCode = (hashCode * 397) ^ (RecordFormat != null ? RecordFormat.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Album != null ? Album.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Size; hashCode = (hashCode * 397) ^ (Genre != null ? Genre.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Rate; return(hashCode); } }
internal string ApplyNamingMask(string NamingMask) { int iter = 0; while (NamingMask.ContainsRenderTag(RenderTags.Track) || NamingMask.ContainsRenderTag(RenderTags.Region) || NamingMask.ContainsRenderTag(RenderTags.Bus)) { iter++; NamingMask = NamingMask.Replace(RenderTags.Format(RenderTags.Track), TrackName.StripRenderTags()); NamingMask = NamingMask.Replace(RenderTags.Format(RenderTags.Region), RegionLabel.StripRenderTags()); NamingMask = NamingMask.Replace(RenderTags.Format(RenderTags.Bus), BusName.StripRenderTags()); if (iter > 3) { break; } } NamingMask = NamingMask.Replace(RenderTags.Format(RenderTags.Counter), String.Format("{0:d" + RenderParams.GetParam <long>(RenderTags.CounterDigits) + "}", CounterIndex)); return(NamingMask); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.idTrack) { hashcode = (hashcode * 397) + IdTrack.GetHashCode(); } if (__isset.trackName) { hashcode = (hashcode * 397) + TrackName.GetHashCode(); } if (__isset.audio) { hashcode = (hashcode * 397) + Audio.GetHashCode(); } } return(hashcode); }
public override string ToString() { var builder = new System.Text.StringBuilder(); builder.AppendFormat("{0} {{", nameof(SessionInfo)).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(Version), Version.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(MessageSessionIndex), MessageSessionIndex.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(ServerSessionIndex), ServerSessionIndex.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(SessionCount), SessionCount.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(ServerName), ServerName.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(TrackName), TrackName.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(TrackLayout), TrackLayout.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(SessionName), SessionName.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(SessionType), SessionType.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(SessionLengthLaps), SessionLengthLaps.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(SessionLengthMinutes), SessionLengthMinutes.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(WaitTime), WaitTime.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(AmbientTemperature), AmbientTemperature.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(RoadTemperature), RoadTemperature.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(Weather), Weather.ToString()).AppendLine(); builder.AppendFormat(" {0} = {1}", nameof(Elapsed), Elapsed.ToString()).AppendLine(); builder.AppendFormat("}}").AppendLine(); return(builder.ToString()); }
public void Play(TrackName name) { Play((uint)name); }
public bool SetBgm(TrackName name) { if (bgm == null || bgm.name != name) { bgm = new Bgm(name); bgm.Attach(gameObject); return true; } return false; }
private void MessageReceived(InSim insim, IS_MSO mso) { try { // const string TimeFormat = "HH:mm";//ex: 23/03/2003 { // chatbox.Text += StringHelper.StripColors(mso.Msg.ToString() + " \r\n"); if (mso.UserType == UserType.MSO_PREFIX) { string Text = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart)); string[] command = Text.Split(' '); command[0] = command[0].ToLower(); switch (command[0]) { case "!ap": case "!adminpanel": var conn = _connections[mso.UCID]; if (conn.IsAdmin == true) { if (conn.inAP == false) { #region ' buttons ' insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 25, ClickID = 25, BStyle = ButtonStyles.ISB_DARK, H = 80, W = 50, T = 52, // up to down L = 75, // left to right }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 26, ClickID = 26, BStyle = ButtonStyles.ISB_LIGHT, H = 9, W = 48, T = 53, // up to down L = 76, // left to right Text = "^7ADMIN PANELET" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 27, ClickID = 27, BStyle = ButtonStyles.ISB_C4, H = 5, W = 48, T = 65, // up to down L = 76, // left to right Text = "^3** Point Administration **" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 28, ClickID = 28, BStyle = ButtonStyles.ISB_RIGHT, H = 4, W = 13, T = 73, // up to down L = 88, // left to right Text = "^71. place:" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 29, ClickID = 29, BStyle = ButtonStyles.ISB_RIGHT, H = 4, W = 13, T = 77, // up to down L = 88, // left to right Text = "^72. place:" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 30, ClickID = 30, BStyle = ButtonStyles.ISB_RIGHT, H = 4, W = 13, T = 81, // up to down L = 88, // left to right Text = "^73. place:" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 31, ClickID = 31, BStyle = ButtonStyles.ISB_RIGHT, H = 4, W = 13, T = 85, // up to down L = 88, // left to right Text = "^74. place:" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 32, ClickID = 32, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 73, // up to down L = 102, // left to right Text = "", TypeIn = 3, Caption = "^0Amount of points to reward 1st place" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 33, ClickID = 33, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 77, // up to down L = 102, // left to right Text = "", TypeIn = 3, Caption = "^0Amount of points to reward 2nd place" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 34, ClickID = 34, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 81, // up to down L = 102, // left to right Text = "", TypeIn = 3, Caption = "^0Amount of points to reward 3rd place" }); insim.Send(new IS_BTN { UCID = mso.UCID, ReqI = 35, ClickID = 35, BStyle = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK, H = 4, W = 5, T = 85, // up to down L = 102, // left to right Text = "", TypeIn = 3, Caption = "^0Amount of points to reward 4th place" }); #endregion conn.inAP = true; } else { insim.Send(mso.UCID, "^1Du er allerede i admin panelet!"); } } else { insim.Send(mso.UCID, "^1Ingen tilgang"); } break; case "!t": insim.Send(mso.UCID, "^8Distance: ^3+3 km"); _connections[mso.UCID].TotalDistance += 3000; break; case "!test": // MessageToAdmins("nub"); insim.Send(mso.UCID, "^8Distance: ^3" + _connections[mso.UCID].TotalDistance); insim.Send(mso.UCID, "^8Nickname: ^3" + _connections[mso.UCID].PName); insim.Send(mso.UCID, "^8Points: ^3" + _connections[mso.UCID].points); break; case "!stats": insim.Send(mso.UCID, "^8Elapsed race time: ^3" + _connections[mso.UCID].ERaceTime); insim.Send(mso.UCID, "^8Laps done: ^3" + _connections[mso.UCID].LapsDone); insim.Send(mso.UCID, "^8Pitstops: ^3" + _connections[mso.UCID].NumStops); insim.Send(mso.UCID, "^8Lap time: ^3" + _connections[mso.UCID].LapTime); insim.Send(mso.UCID, "^8Car: ^3" + _connections[mso.UCID].CarName); insim.Send(mso.UCID, "^8Track: ^3" + TrackName.ToUpper()); insim.Send(mso.UCID, "^3[" + TrackName + "] ^8Completed a lap: ^3" + string.Format("{0:00}:{1:00}:{2:0}", (int)_connections[mso.UCID].LapTime.Minutes, _connections[mso.UCID].LapTime.Seconds, _connections[mso.UCID].LapTime.Milliseconds) + " ^8- ^3" + _connections[mso.UCID].CarName); break; case "!ac": { //Admin chat if (mso.UCID == _connections[mso.UCID].UCID) { if (!IsConnAdmin(_connections[mso.UCID])) { insim.Send(mso.UCID, 0, "You are not an admin"); break; } if (command.Length == 1) { insim.Send(mso.UCID, 0, "^1Invalid command format. ^2Usage: ^7!ac <text>"); break; } string atext = Text.Remove(0, command[0].Length + 1); foreach (var Conn in _connections.Values) { { if (IsConnAdmin(Conn) && Conn.UName != "") { insim.Send(Conn.UCID, 0, "^3Admin chat: ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + "):"); insim.Send(Conn.UCID, 0, "^7" + atext); } } } } break; } case "!p": case "!pen": case "!penalty": insim.Send("/p_clear " + _connections[mso.UCID].UName); break; case "!help": insim.Send(mso.UCID, 0, "^3Help commands (temporary list):"); insim.Send(mso.UCID, 0, "^7!help ^8- See a list of available commands"); insim.Send(mso.UCID, 0, "^7!info ^8- See a few lines of server info"); insim.Send(mso.UCID, 0, "^7!showoff (!show) ^8- Show your stats to everyone connected to the server"); insim.Send(mso.UCID, 0, "^7!pen (!p) ^8- Remove the pit penalty"); insim.Send(mso.UCID, 0, "^7!gmt <timezone> ^8- Set your own timezone, ex: !gmt +12"); // Admin commands foreach (var CurrentConnection in _connections.Values) { if (CurrentConnection.UCID == mso.UCID) { if (IsConnAdmin(CurrentConnection) && CurrentConnection.UName != "") { insim.Send(CurrentConnection.UCID, 0, "^3Administrator commands:"); insim.Send(CurrentConnection.UCID, 0, "^7!ac ^8- Talk with the other admins that are online"); insim.Send(CurrentConnection.UCID, 0, "^7!pos ^8- Check your current position in x y z"); } } } break; default: insim.Send(mso.UCID, 0, "^8Invalid command, type ^2{0}^8 to see available commands", "!help"); break; } } } } catch (Exception e) { LogTextToFile("commands", "[" + mso.UCID + "] " + StringHelper.StripColors(_connections[mso.UCID].PName) + "(" + GetConnection(mso.PLID).UName + ") NPL - Exception: " + e, false); } }
public virtual string GetSourceName() { return(Source + "_" + Bitrate.ToString() + "_" + (string.IsNullOrEmpty(TrackName) ? "unknown" :TrackName.ToString())); }
public Track(string filename) { initDefaultValues(); StreamReader reader = new StreamReader(filename); try { string line = reader.ReadLine(); //VERSION:X for new format, [HEADER] for legacy //check if we need the legacy parser if (!line.StartsWith("VERSION")) { parseLegacyTrack(reader); return; } //Debug.Log("parsing Track"); int fileVersion = int.Parse(line.Split(':')[1]); Debug.Log("parsing Track Version = " + fileVersion); line = reader.ReadLine(); //[HEADER] //Debug.Log("Filename=" + filename); Char separator = '/'; //Path.DirectorySeparatorChar doesnt give the correct one here...? //Debug.Log("DirectorySeparator=" + separator + "last index in filename = " + filename.LastIndexOf(separator)); TrackName = filename.Substring(filename.LastIndexOf(separator) + 1); //cut path //Debug.Log("cut-down filename = " + TrackName); TrackName = TrackName.Substring(0, TrackName.Length - 4); //cut .trk //Debug.Log("final trackname = " + TrackName); Debug.Log(line); bool makeVisible = false; while (line != "[WAYPOINTS]" && !reader.EndOfStream) { line = reader.ReadLine(); //Debug.Log("HeaderLine:" + line); String[] lineSplit = line.Split(':'); if (lineSplit[0].Equals("VESSELNAME")) { VesselName = lineSplit[1]; } else if (lineSplit[0].Equals("DESCRIPTION")) { Description = lineSplit[1]; } else if (lineSplit[0].Equals("VISIBLE")) { makeVisible = lineSplit[1].Equals("1"); } else if (lineSplit[0].Equals("MAINBODY")) { this.referenceBody = Utilities.CelestialBodyFromName(lineSplit[1]); } else if (lineSplit[0].Equals("SAMPLING")) { this.SamplingFactor = int.Parse(lineSplit[1]); } else if (lineSplit[0].Equals("LINECOLOR")) { LineColor = Utilities.makeColor(lineSplit[1]); } else if (lineSplit[0].Equals("LINEWIDTH")) { LineWidth = float.Parse(lineSplit[1]); } else if (lineSplit[0].Equals("CONERADIUSFACTOR")) { ConeRadiusToLineWidthFactor = float.Parse(lineSplit[1]); } else if (lineSplit[0].Equals("NUMDIRECTIONMARKERS")) { NumDirectionMarkers = int.Parse(lineSplit[1]); } else if (lineSplit[0].Equals("REPLAYCOLLIDERS")) { ReplayColliders = lineSplit[1].Equals("1"); } else if (lineSplit[0].Equals("END")) { //Debug.Log("Parsing END-TAG="+lineSplit[1]); EndAction = (EndActions)Enum.Parse(typeof(EndActions), lineSplit[1]); //Debug.Log("EndAction = " + EndAction.ToString("F")); if (EndAction == EndActions.LOOP) { //Debug.Log("LOOP endaction: Parsing string for looptime=" + lineSplit[2]); LoopClosureTime = float.Parse(lineSplit[2]); } } } //End Header line = reader.ReadLine(); //first actual waypoint while (line != "[LOGENTRIES]" && !reader.EndOfStream) { //Debug.Log("Waypointline = " + line); string[] split = line.Split(';'); double lat, lon, alt, time; float oriX, oriY, oriZ, oriW, vX, vY, vZ; Double.TryParse(split[0], out time); Double.TryParse(split[1], out lat); Double.TryParse(split[2], out lon); Double.TryParse(split[3], out alt); float.TryParse(split[4], out oriX); float.TryParse(split[5], out oriY); float.TryParse(split[6], out oriZ); float.TryParse(split[7], out oriW); float.TryParse(split[8], out vX); float.TryParse(split[9], out vY); float.TryParse(split[10], out vZ); waypoints.Add(new Waypoint(lat, lon, alt, new Quaternion(oriX, oriY, oriZ, oriW), new Vector3(vX, vY, vZ), time)); line = reader.ReadLine(); } Debug.Log("reading logentries"); line = reader.ReadLine();//first entry while (!reader.EndOfStream) { string trimmed = line; trimmed = trimmed.Trim(); if (!string.IsNullOrEmpty(trimmed)) { //Debug.Log("reading logentryline = " + line); string[] split = line.Split(';'); double lat, lon, alt, time; Double.TryParse(split[0], out lat); Double.TryParse(split[1], out lon); Double.TryParse(split[2], out alt); Double.TryParse(split[3], out time); logEntries.Add(new LogEntry(lat, lon, alt, new Quaternion(), new Vector3(), time, split[4], split[5])); } line = reader.ReadLine(); } Debug.Log("Created track from file containing " + waypoints.Count + "waypoints and " + logEntries.Count + " log entries"); Visible = makeVisible; //set visible at end only } catch (Exception e) { Debug.Log(e.ToString()); } }
public virtual string GetSourceName() { return(Source + "_" + Bitrate.ToString() + "_" + TrackName.ToString()); }
public void switchTrack(TrackName name) { Debug.Log("Switching to track " + name); currentTrack = forName(name); sequenceCurrentClip(); }
public Bgm(TrackName track) { clip = Resources.Load("music/" + track.ToString()) as AudioClip; name = track; }
public TrackNameViewModel(TrackName trackName) { this.trackName = trackName; }
public static void play(TrackName a) { try { t.Abort(); } catch (Exception e) { } switch (a) { case TrackName.SMBDie: t = new Thread(new ThreadStart(musicSMBDie)); break; case TrackName.SMBWin: t = new Thread(new ThreadStart(musicSMBWin)); break; case TrackName.NSMBBGM: t = new Thread(new ThreadStart(musicNSMBBGM)); break; case TrackName.SMDDie: t = new Thread(new ThreadStart(musicSMBDieBass)); break; case TrackName.SMDWin: t = new Thread(new ThreadStart(musicSMDWin)); break; case TrackName.Sonic1GHZ: t = new Thread(new ThreadStart(musicS1GHZ)); break; case TrackName.ReconstructingMoreScience: t = new Thread(new ThreadStart(musicReconstructScience)); break; case TrackName.YourPreciousMoon: t = new Thread(new ThreadStart(musicPreciousMoon)); break; case TrackName.MagicRoundabout: t = new Thread(new ThreadStart(musicMagicRnd)); break; case TrackName.AllStar: t = new Thread(new ThreadStart(musicAllStar)); break; case TrackName.Umaru: t = new Thread(new ThreadStart(musicUMR)); break; case TrackName.Futurama: t = new Thread(new ThreadStart(musicFut)); break; case TrackName.PinkPanther: t = new Thread(new ThreadStart(musicPP)); break; default: t = new Thread(() => Beep()); break; } t.Start(); }