public SoundEffectInstance GetTrackedInstance(GameSound gameSound, SoundEffectFinished callback) { var result = this[gameSound].CreateInstance(); var tuple = new Tuple<GameSound, SoundEffectFinished>(gameSound, callback); this._trackingInstances.Add(result, tuple); return result; }
public IGameSoundInstance GetSoundEffectInstance(GameSound gameSound) { var soundEffectInstance = this._soundLibrary[gameSound].CreateInstance(); soundEffectInstance.Volume = 0; var result = new GameSoundInstance(soundEffectInstance); return result; }
// Use this for initialization void Start() { if (this.isDeductionLife) { this.cloneSoundObject = (GameObject)Instantiate(this.SoundObject, this.transform.position, Quaternion.identity); this.gameSoundScript = this.cloneSoundObject.GetComponent<GameSound>(); } }
public void Play(GameSound gameSound, SoundEffectFinished callback) { if (callback == null) throw new ArgumentNullException("callback"); var soundEffectInstance = this._soundLibrary.GetTrackedInstance(gameSound, callback); soundEffectInstance.Play(); }
public SoundEffect this[GameSound gameSound] { get { var result = this._sounds[gameSound]; return result; } }
public void Play(GameSound gameSound, SoundEffectFinished callback) { if (callback == null) throw new ArgumentNullException("callback"); var args = new SoundEffectFinishedEventArgs(gameSound); callback(this, args); }
public static void PlayGameSound(GameSound sound) { var isSubscribed = SubscriptionModule.Get().IsSubscribed ?? false; if (isSubscribed && Prefs.EnableGameSound) { Log.InfoFormat("Playing game sound {0}", sound.Name); if (!sound.Src.ToLowerInvariant().EndsWith(".mp3")) { Log.InfoFormat("Playing game sound {0} as wav", sound.Name); PlaySound(sound.Src); return; } Task.Factory.StartNew(() => { try { Log.InfoFormat("Playing game sound {0} as mp3", sound.Name); using (var mp3Reader = new Mp3FileReader(sound.Src)) using (var stream = new WaveChannel32(mp3Reader) { PadWithZeroes = false }) using (var wo = new WaveOutEvent()) { Log.InfoFormat("Initializing game sound {0} as mp3", sound.Name); wo.Init(stream); wo.Play(); Log.InfoFormat("Waiting for game sound {0} to complete", sound.Name); while (wo.PlaybackState == PlaybackState.Playing) { Thread.Sleep(1); } Log.InfoFormat("Game sound {0} completed", sound.Name); } } catch (Exception e) { Log.Warn("PlayGameSound Error", e); } }); } }
public static void PlayGameSound(GameSound sound) { var isSubscribed = SubscriptionModule.Get().IsSubscribed ?? false; if (isSubscribed && Prefs.EnableGameSound) { try { using (var player = new SoundPlayer(sound.Src)) { player.PlaySync(); } } catch (Exception e) { Log.Warn("PlayGameSound Error", e); } } }
/// <summary> /// Setup fighter for the local player. /// </summary> public void Setup() { var vehModel = new Model(VehicleHash.Lazer); if (!vehModel.IsLoaded) { vehModel.Request(1000); } //Create the vehicle var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, Team.JetSpawnPoint.Position)); vehicle.Heading = Team.JetSpawnPoint.Heading; vehicle.Vehicle.EngineRunning = true; vehicle.IsInvincible = true; vehicle.MaxSpeed = 110; ManagedVehicle = vehicle; ManagedVehicle.EnterWater += EnterWater; irFlares = new IRFlareManager(); irFlares.SetupWithVehicle(ManagedVehicle.Vehicle); //Handle the ped var ped = new ManageablePed(Game.Player.Character); ped.Ped.RelationshipGroup = Team.RelationshipGroup; ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver); ped.IsInvincible = true; ManagedPed = ped; ManagedPed.ExitVehicle += ExitVehicle; interpCam = new InterpolatingCamera(vehicle.GetOffsetInWorldCoords(new Vector3(-2f, -2f, 10f))); interpCam.MainCamera.PointAt(vehicle); interpCam.Start(); engineFX1 = new LoopedPTFX("core", "ent_sht_extinguisher"); engineSound = new GameSound("SPRAY", "CARWASH_SOUNDS"); boostTimer.Start(); }
public void SaveSettings() { StreamWriter SW = new StreamWriter(Globals.Files + "Settings.ini"); StringBuilder SB = new StringBuilder(); SB.AppendLine("GameDirectory:" + Globals.GameDirectory); SB.AppendLine("LauncherRunPath:" + AppDomain.CurrentDomain.BaseDirectory); SB.AppendLine("PlayerTag:" + PlayerTag); SB.AppendLine("DisplayMode:" + DisplayMode.ToString()); SB.AppendLine("GameSound:" + GameSound.ToString()); SB.AppendLine("VerticalSync:" + VerticalSync.ToString()); SB.AppendLine("DefaultDisplay:" + DefaultDisplay.ToString()); SB.AppendLine("RememberMe:" + RememberMe.ToString()); SB.AppendLine("PlayerLoginToken:" + Encrypt.EncryptStringAES(PlayerLoginToken)); SW.Write(SB.ToString()); SW.Flush(); SW.Close(); SW.Dispose(); }
/// <summary> /// Returns whether playback of a given soundtype is possible, and if so, returns all sound variations available for the given soundtype (or null). /// </summary> private (bool canPlay, List <SoundEntity> availableSounds) SoundPlayPreChecks(GameSound soundType) { // Initialization is expected to happen earlier if (!_initialized) { _log?.Initialization_HadToExpedite(); Awake(); } // Sound type 'None' is not valid for playback if (soundType == GameSound.None) { _log?.PlaybackFail_NoneSoundRequested(); return(canPlay : false, null); } var soundListExists = _soundMap.TryGetValue(soundType, out var soundList); // Note out var // No valid sound entries are defined for the requested soundtype - i.e. nothing to play if (!soundListExists) { _log?.PlaybackFail_NoEntryDefined(soundType); return(canPlay : false, null); } if (_soundPlayerPool.Count == 0) { // Playback fails if pool is exhausted, and we can't grow if (!_canGrowPool) { _log?.PlaybackFail_PoolExhausted(); return(canPlay : false, null); } // If pool can grow, grow pool, and proceed with playback _log?.PoolHadToGrow(); GrowPool(1); } return(canPlay : true, soundList); }
private void playSound(Sounds soundEnum, AudioSource audioSource) { GameSound sound = getSound(soundEnum); if (sound == null) { Debug.LogError("sound is null."); return; } if (audioSource == null) { Debug.LogError("audioSource is null. Not playing [" + sound.SoundEffect.name + "]"); return; } if (!sound.Enabled) { Debug.LogError("SoundEffect is disabled. Not playing [" + sound.SoundEffect.name + "]"); return; } //Create an empty game object GameObject go = new GameObject("Audio: " + sound.SoundEffect.name); go.transform.position = transform.position; go.transform.parent = transform; //Create the source AudioSource source = go.AddComponent <AudioSource>(); source.clip = sound.SoundEffect; source.volume = sound.Volume; // source.pitch = pitch; source.Play(); Destroy(go, sound.SoundEffect.length); // audioSource.PlayOneShot(sound.SoundEffect, sound.Volume); }
void Start() { timer = 0f; isHoveredOver = false; isBeingHeld = false; isPlacedCorrectly = false; ogPosition = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z); respHolder = GameObject.Find("Holder " + index); hand = GameObject.Find("The Hand"); puzzle = GameObject.Find("PuzzleRoot"); dropButton = GameObject.Find("DropButton"); highSortOrder = puzzle.GetComponent <Puzzle>().numPieces + 1; sound = GameObject.Find("Soundifier").GetComponent <GameSound>(); startedLerp1 = false; completedLerp1 = false; startedLerp2 = false; completedLerp2 = false; startedLerp3 = false; completedLerp3 = false; }
public IEnumerator SoundInfoLoad() { TextAsset asset = Resources.Load("XmlFiles/soundInfo") as TextAsset; XmlDocument doc = new XmlDocument(); doc.LoadXml(asset.text); XmlNodeList nodes = doc.SelectNodes("/sound/music"); foreach (XmlNode node in nodes) { GameSound sound = new GameSound(); sound.soundName = node.SelectSingleNode("name/soundName").InnerText; sound.soundType = node.SelectSingleNode("soundType").InnerText; sound.soundClip = Resources.Load <AudioClip>("Sounds/" + sound.soundType + "/" + sound.soundName); GameData.gameSounds.Add(sound); yield return(null); } }
private void Update() { for (int i = 0; i < lerpPitchSounds.Count; i += 1) { GameSound gameSound = lerpPitchSounds[i]; if (gameSound.sound.isPlaying) { if (gameSound.lerpingUp) { gameSound.lerpTimer += Time.unscaledDeltaTime * pitchLerpSpeedUp; gameSound.sound.pitch = Mathf.Lerp(gameSound.sound.pitch, maxPitch, gameSound.lerpTimer); if (Mathf.Abs(gameSound.sound.pitch - maxPitch) < 0.01f) { gameSound.lerpingUp = false; gameSound.sound.pitch = maxPitch; } } else if (gameSound.lerpingDown) { gameSound.lerpTimer += Time.unscaledDeltaTime * pitchLerpSpeedDown; gameSound.sound.pitch = Mathf.Lerp(gameSound.sound.pitch, minPitch, gameSound.lerpTimer); if (Mathf.Abs(gameSound.sound.pitch - minPitch) < 0.01f) { gameSound.lerpingDown = false; gameSound.sound.pitch = 1f; } } else { gameSound.lerpTimer = 0f; lerpPitchSounds.Remove(gameSound); } } else { gameSound.lerpTimer = 0f; lerpPitchSounds.Remove(gameSound); } } }
public void init(string textura, TgcMesh planta) { var d3dDevice = D3DDevice.Instance.Device; #region configurarObjeto var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, GameModel.mediaDir + "modelos\\Textures\\" + textura + ".jpg"); esfera = new TGCSphere(1, texture.Clone(), TGCVector3.Empty); efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx"); esfera.Effect = efecto; esfera.Technique = "RenderScene"; esfera.Scale = new TGCVector3(30.5f, 30.5f, 30.5f); esfera.Position = planta.Position; esfera.Rotation = planta.Rotation; esfera.updateValues(); objetos.Add(esfera); #endregion GameSound.disparar(); PostProcess.agregarPostProcessObject(this); }
public static void PlayGameSound(GameSound sound) { var isSubscribed = SubscriptionModule.Get().IsSubscribed ?? false; if (isSubscribed && Prefs.EnableGameSound) { Task.Factory.StartNew(() => { try { if (sound.Src.ToLowerInvariant().EndsWith(".mp3")) { using (var mp3Reader = new Mp3FileReader(sound.Src)) using (var stream = new WaveChannel32(mp3Reader)) using (var wo = new WaveOut()) { wo.Init(stream); wo.Play(); while (wo.PlaybackState == PlaybackState.Playing) { Thread.Sleep(1); } } } else { using (var player = new SoundPlayer(sound.Src)) { player.PlaySync(); } } } catch (Exception e) { Log.Warn("PlayGameSound Error", e); } }); } }
private void OnCheckSym(Box box1, Box box2) { if (box1.Symbol == box2.Symbol) { box1.Hide(1.5f); box2.Hide(1.5f); lastBox = null; currentBox = null; swapToShirtTime = -1; score++; var effect = MatchEffectPool.Get(); effect.transform.localPosition = box1.transform.localPosition; effect.SetActive(true); LeanTween.delayedCall(2f, HideEffects).setOnCompleteParam(effect); effect = MatchEffectPool.Get(); effect.transform.localPosition = box2.transform.localPosition; effect.SetActive(true); LeanTween.delayedCall(2f, HideEffects).setOnCompleteParam(effect); GameSound.Play(matchSound); if (score == (rowSize * colSize) / 2) { if (EndGame != null) { EndGame.Invoke(); } GameSound.Play(gameWinSound); LeanTween.delayedCall(3f, Init); } } else { swapToShirtTime = Time.time + ShowBoxTime; } }
// Methods. public void Initialize() { const Byte gameOffset = 100; GameState = new GameState(); Vector2 statePosn = new Vector2(5, 4 + Constants.GameOffsetY); Rectangle stateColl = new Rectangle(0, +Constants.GameOffsetY, gameOffset, gameOffset); GameState.Initialize(statePosn, stateColl); GameSound = new GameSound(); Vector2 soundPosn = new Vector2(725, 4 + Constants.GameOffsetY); Rectangle soundColl = new Rectangle(Constants.ScreenWide - gameOffset, 0 + Constants.GameOffsetY, gameOffset, gameOffset); GameSound.Initialize(soundPosn, soundColl); // Joystick controller. JoypadMove = new JoypadMove(); Vector2 jpPos = new Vector2(20, 300 + Constants.GameOffsetY); Rectangle jpColl = new Rectangle(-100, 180 + Constants.GameOffsetY, 400, 400); Rectangle jpBndl = new Rectangle(0, 280 + Constants.GameOffsetY, 200, 200); JoypadMove.Initialize(jpPos, jpColl, jpBndl); // Joystick fire button. const Byte fireOffsetX = Constants.FIRE_OFFSET_X; const Byte fireOffsetY = Constants.FIRE_OFFSET_Y; JoyButton = new JoyButton(); const Byte textSize = Constants.TextsSize; const Byte baseSize = Constants.BaseSize; Vector2 firePosn = new Vector2(Constants.ScreenWide - baseSize - (2 * textSize), Constants.ScreenHigh - Constants.GameOffsetY - baseSize - (1 * textSize)); Rectangle fireColl = new Rectangle(Constants.ScreenWide - fireOffsetX, Constants.ScreenHigh - Constants.GameOffsetY - fireOffsetY, fireOffsetX, fireOffsetY); JoyButton.Initialize(firePosn, fireColl); }
public InitialState() { GameInput.SimulateInput(true); startTime = Time.time; GameObject player = GameManager.GetPlayer(); GameInput.cameraEulerAngles = player.transform.eulerAngles; GameInput.cameraForward = player.transform.forward; friend = GameManager.GetFriend(); friendRB = friend.GetComponent <Rigidbody>(); friendMaterial = friend.GetComponentInChildren <SkinnedMeshRenderer>().material; friend.GetComponent <Animator>().SetTrigger("isWalking"); playerMovement = GameManager.GetPlayer().GetComponent <PlayerMovement>(); initialSpeed = playerMovement.movementSpeed; playerMovement.movementSpeed = stateSpeed; GameSound.Play("death_scene"); GameObject[] ui = GameObject.FindGameObjectsWithTag("IntroFade"); MonoBehaviour gameName = ui[0].GetComponentInChildren <MonoBehaviour>(); gameName.enabled = true; MonoBehaviour titleCard = ui[1].GetComponentInChildren <MonoBehaviour>(); titleCard.enabled = true; }
/// <summary> /// Plays a sound which is centred on this instance /// </summary> /// <param name="gameObject">The gameobject to attach the sound to</param> /// <param name="gameSound">Sets which sound to play</param> public static void PlaySound(this IGameObject gameObject, GameSound gameSound) { GlobalServices.SoundPlayer.PlayForObject(gameSound, gameObject, GlobalServices.CentrePointProvider); }
// Use this for initialization void Start() { this.penguinScript = this.GetComponent<PenguinAngleReturn>(); this.phidgetSetting = GameObject.Find("GamePhidgetSetting").GetComponent<PhidgetSetting>(); this.cloneSoundObject = (GameObject)Instantiate(this.SoundObject, this.transform.position, Quaternion.identity); this.gameSoundScript = this.cloneSoundObject.GetComponent<GameSound>(); this.create = this.transform.parent.GetComponent<Create>(); }
public void StopSound(GameSound sound) { throw new NotImplementedException(); }
/// <summary> /// Setup fighter for the local player. /// </summary> public void Setup() { var vehModel = new Model(VehicleHash.Lazer); if (!vehModel.IsLoaded) vehModel.Request(1000); //Create the vehicle var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, Team.JetSpawnPoint.Position)); vehicle.Heading = Team.JetSpawnPoint.Heading; vehicle.Vehicle.EngineRunning = true; vehicle.IsInvincible = true; vehicle.MaxSpeed = 110; ManagedVehicle = vehicle; ManagedVehicle.EnterWater += EnterWater; irFlares = new IRFlareManager(); irFlares.SetupWithVehicle(ManagedVehicle.Vehicle); //Handle the ped var ped = new ManageablePed(Game.Player.Character); ped.Ped.RelationshipGroup = Team.RelationshipGroup; ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver); ped.IsInvincible = true; ManagedPed = ped; ManagedPed.ExitVehicle += ExitVehicle; interpCam = new InterpolatingCamera(vehicle.GetOffsetInWorldCoords(new Vector3(-2f, -2f, 10f))); interpCam.MainCamera.PointAt(vehicle); interpCam.Start(); engineFX1 = new LoopedPTFX("core", "ent_sht_extinguisher"); engineSound = new GameSound("SPRAY", "CARWASH_SOUNDS"); boostTimer.Start(); }
// Use this for initialization void Start() { this.gameSoundScript = GameObject.Find("GameSound").GetComponent<GameSound>(); }
public override void Death() { Instantiate(DataGame.current.prefabSmallExplosion, new Vector2(transform.position.x, transform.position.y), Quaternion.identity); // Создаём взрыв уничтожения GameSound.PlaySoundAsteroidExplosion(); // Воспроизводим звук взрыва Destroy(gameObject); // Уничтожаем объект }
public PlaySound(UnitType unitType, uint uid, GameSound sound) : base(Build(unitType, uid, sound)) { this.unitType = unitType; this.uid = uid; this.sound = sound; }
public AudioSource[] Shot; // Выстрел //public AudioSource[] BackgroundMelody; // Фоновая музыка private void Awake() { current = this; }
public void despegar() { volar = true; GameSound.volar(); }
public void Play(GameSound gameSound) { // nothing to do }
public static byte[] Build(UnitType unitType, uint uid, GameSound sound) { return new byte[] { 0x2c, (byte)unitType, ((byte)uid), ((byte)(uid >> 8)), ((byte)(uid >> 0x10)), ((byte)(uid >> 0x18)), ((byte)sound), ((byte)(((ushort)sound) >> 8)) }; }
public void PlaySound(GameSound sound) { sounds[(int)sound].Play(); }
public void Play(GameSound gameSound) { soundPlayers[gameSound].Play(); }
// Use this for initialization private void Awake() { instance = this; }
public SendCharacterSpeech(GameSound speech) : base(Build(speech)) { this.speech = speech; }
public void PlaySound(GameSound sound) { if (audio != null) { audio.PlaySound(sound); } }
public void Play(GameSound gameSound) { // do nothing }
// Methods public SendCharacterSpeech(byte[] data) : base(data) { this.speech = (GameSound) BitConverter.ToUInt16(data, 1); }
/// <summary> /// Plays the specified sound with volume and pitch overrides, while following the specified transform's position. /// If multiple sounds are registed for the given type, selects one randomly. /// </summary> /// <param name="soundType">The pre-defined identifier of the sound to play.</param> /// <param name="targetTransform">The transform to be followed during the playback.</param> /// <param name="volumeMultiplier">The multiplier to apply to the volume. Applies on top of the random range value defined in Inspector.</param> /// <param name="pitchMultiplier">The multiplier to apply to the pitch. Applies on top of the random range value defined in Inspector.</param> /// <param name="playFinishedCallback">Delegate to be invoked when playback completed.</param> /// <returns>Returns the AudioSource that is playing the requested sound. Don't mess with it if you want the soundmanager to work dependably.</returns> public AudioSource PlaySoundPositioned(GameSound soundType, float volumeMultiplier, float pitchMultiplier, Transform targetTransform, Action <GameSound> playFinishedCallback = null) => Play_Internal(soundType, volumeMultiplier, pitchMultiplier, PlayMode.Tracking, targetTransform, _zeroVector, playFinishedCallback);
public static byte[] Build(GameSound speech) { return new byte[] { 0x3f, ((byte) speech), ((byte) (((ushort) speech) >> 8)) }; }
// Methods public PlaySound(byte[] data) : base(data) { this.unitType = (UnitType) data[1]; this.uid = BitConverter.ToUInt32(data, 2); this.sound = (GameSound) BitConverter.ToUInt16(data, 6); }
public void PlaySound(GameSound sound, bool loop) { throw new NotImplementedException(); }
public void SoundEntries_FaultyEntry_NoAudioClip(GameSound missingClipType) => Debug.LogWarning($"An entry for soundtype '{missingClipType}' missing its {nameof(AudioClip)}. This entry will be ignored.");
public bool IfSound(GameSound sound) { throw new NotImplementedException(); }
public void PlaybackFail_NoEntryDefined(GameSound soundType) => Debug.LogWarning($"Sound playback failed. Soundtype '{soundType}' has no sounds assigned to it.");
public object Deserialize(string fileName) { var serializer = new XmlSerializer(typeof(game)); directory = new FileInfo(fileName).Directory.FullName; game g = null; var fileHash = ""; using (var fs = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { g = (game)serializer.Deserialize(fs); if (g == null) { return(null); } using (MD5 md5 = new MD5CryptoServiceProvider()) { fs.Seek(0, SeekOrigin.Begin); byte[] retVal = md5.ComputeHash(fs); fileHash = BitConverter.ToString(retVal).Replace("-", ""); // hex string } } var ret = new Game() { Id = new Guid(g.id), Name = g.name, CardBack = String.IsNullOrWhiteSpace(g.card.back) ? "pack://application:,,,/Resources/Back.jpg" : Path.Combine(directory, g.card.back), CardFront = String.IsNullOrWhiteSpace(g.card.front) ? "pack://application:,,,/Resources/Front.jpg" : Path.Combine(directory, g.card.front), CardHeight = int.Parse(g.card.height), CardWidth = int.Parse(g.card.width), CardCornerRadius = int.Parse(g.card.cornerRadius), Version = Version.Parse(g.version), CustomProperties = new List <PropertyDef>(), DeckSections = new Dictionary <string, DeckSection>(), SharedDeckSections = new Dictionary <string, DeckSection>(), GlobalVariables = new List <GlobalVariable>(), Authors = g.authors.Split(',').ToList(), Description = g.description, Filename = fileName, Fonts = new List <Font>(), GameUrl = g.gameurl, IconUrl = g.iconurl, Tags = g.tags.Split(' ').ToList(), OctgnVersion = Version.Parse(g.octgnVersion), Variables = new List <Variable>(), MarkerSize = g.markersize, Documents = new List <Document>(), Sounds = new Dictionary <string, GameSound>(), FileHash = fileHash, Events = new Dictionary <string, GameEvent[]>(), InstallPath = directory, UseTwoSidedTable = g.usetwosidedtable == boolean.True ?true : false, NoteBackgroundColor = g.noteBackgroundColor, NoteForegroundColor = g.noteForegroundColor, }; #region variables if (g.variables != null) { foreach (var item in g.variables) { ret.Variables.Add(new Variable { Name = item.name, Global = bool.Parse(item.global.ToString()), Reset = bool.Parse(item.reset.ToString()), Default = int.Parse(item.@default) }); } } #endregion variables #region table ret.Table = this.DeserialiseGroup(g.table, 0); #endregion table #region shared if (g.shared != null) { var player = new GlobalPlayer { Counters = new List <Counter>(), Groups = new List <Group>() }; var curCounter = 1; var curGroup = 1; if (g.shared.counter != null) { foreach (var i in g.shared.counter) { (player.Counters as List <Counter>).Add( new Counter { Id = (byte)curCounter, Name = i.name, Icon = Path.Combine(directory, i.icon ?? ""), Reset = bool.Parse(i.reset.ToString()), Start = int.Parse(i.@default) }); curCounter++; } } if (g.shared.group != null) { foreach (var i in g.shared.group) { (player.Groups as List <Group>).Add(this.DeserialiseGroup(i, curGroup)); curGroup++; } } ret.GlobalPlayer = player; } #endregion shared #region Player if (g.player != null) { var player = new Player { Groups = new List <Group>(), GlobalVariables = new List <GlobalVariable>(), Counters = new List <Counter>(), IndicatorsFormat = g.player.summary }; var curCounter = 1; var curGroup = 1; foreach (var item in g.player.Items) { if (item is counter) { var i = item as counter; (player.Counters as List <Counter>) .Add(new Counter { Id = (byte)curCounter, Name = i.name, Icon = Path.Combine(directory, i.icon ?? ""), Reset = bool.Parse(i.reset.ToString()), Start = int.Parse(i.@default) }); curCounter++; } else if (item is gamePlayerGlobalvariable) { var i = item as gamePlayerGlobalvariable; var to = new GlobalVariable { Name = i.name, Value = i.value, DefaultValue = i.value }; (player.GlobalVariables as List <GlobalVariable>).Add(to); } else if (item is hand) { player.Hand = this.DeserialiseGroup(item as hand, 0); } else if (item is group) { var i = item as group; (player.Groups as List <Group>).Add(this.DeserialiseGroup(i, curGroup)); curGroup++; } } ret.Player = player; } #endregion Player #region documents if (g.documents != null) { foreach (var doc in g.documents) { var d = new Document(); d.Icon = Path.Combine(directory, doc.icon); d.Name = doc.name; d.Source = Path.Combine(directory, doc.src); ret.Documents.Add(d); } } #endregion documents #region sounds if (g.sounds != null) { foreach (var sound in g.sounds) { var s = new GameSound(); s.Gameid = ret.Id; s.Name = sound.name; s.Src = Path.Combine(directory, sound.src); ret.Sounds.Add(s.Name.ToLowerInvariant(), s); } } #endregion sounds #region deck if (g.deck != null) { foreach (var ds in g.deck) { ret.DeckSections.Add(ds.name, new DeckSection { Group = ds.group, Name = ds.name, Shared = false }); } } if (g.sharedDeck != null) { foreach (var s in g.sharedDeck) { ret.SharedDeckSections.Add(s.name, new DeckSection { Group = s.group, Name = s.name, Shared = true }); } } #endregion deck #region card if (g.card != null && g.card.property != null) { foreach (var prop in g.card.property) { var pd = new PropertyDef(); pd.Name = prop.name; switch (prop.textKind) { case propertyDefTextKind.Free: pd.TextKind = PropertyTextKind.FreeText; break; case propertyDefTextKind.Enum: pd.TextKind = PropertyTextKind.Enumeration; break; case propertyDefTextKind.Tokens: pd.TextKind = PropertyTextKind.Tokens; break; default: throw new ArgumentOutOfRangeException(); } pd.Type = (PropertyType)Enum.Parse(typeof(PropertyType), prop.type.ToString()); pd.IgnoreText = bool.Parse(prop.ignoreText.ToString()); pd.Hidden = bool.Parse(prop.hidden); ret.CustomProperties.Add(pd); } } var namepd = new PropertyDef(); namepd.Name = "Name"; namepd.TextKind = PropertyTextKind.FreeText; namepd.Type = PropertyType.String; ret.CustomProperties.Add(namepd); #endregion card #region fonts if (g.fonts != null) { foreach (gameFont font in g.fonts) { Font f = new Font(); f.Src = Path.Combine(directory, font.src ?? ""); f.Size = (int)font.size; switch (font.target) { case fonttarget.chat: f.Target = Enum.Parse(typeof(fonttarget), "chat").ToString(); break; case fonttarget.context: f.Target = Enum.Parse(typeof(fonttarget), "context").ToString(); break; case fonttarget.deckeditor: f.Target = Enum.Parse(typeof(fonttarget), "deckeditor").ToString(); break; } ret.Fonts.Add(f); } } #endregion fonts #region scripts if (g.scripts != null) { foreach (var s in g.scripts) { var coll = Def.Config .DefineCollection <GameScript>("Scripts") .OverrideRoot(x => x.Directory("GameDatabase")) .SetPart(x => x.Directory(ret.Id.ToString())); var pathParts = s.src.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); for (var index = 0; index < pathParts.Length; index++) { var i = index; if (i == pathParts.Length - 1) { coll.SetPart(x => x.File(pathParts[i])); } else { coll.SetPart(x => x.Directory(pathParts[i])); } } coll.SetSerializer(new GameScriptSerializer(ret.Id)); } } #endregion scripts #region events if (g.events != null) { foreach (var e in g.events) { var eve = new GameEvent() { Name = e.name.Clone() as string, PythonFunction = e.action.Clone() as string }; if (ret.Events.ContainsKey(e.name)) { var narr = ret.Events[e.name]; Array.Resize(ref narr, narr.Length + 1); narr[narr.Length - 1] = eve; ret.Events[e.name] = narr; } else { ret.Events.Add(e.name, new GameEvent[1] { eve }); } } } #endregion Events #region proxygen if (g.proxygen != null) { var coll = Def.Config.DefineCollection <ProxyDefinition>("Proxies") .OverrideRoot(x => x.Directory("GameDatabase")) .SetPart(x => x.Directory(ret.Id.ToString())); //.SetPart(x => x.Property(y => y.Key)); var pathParts = g.proxygen.definitionsrc.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); for (var index = 0; index < pathParts.Length; index++) { var i = index; if (i == pathParts.Length - 1) { coll.SetPart(x => x.File(pathParts[i])); } else { coll.SetPart(x => x.Directory(pathParts[i])); } } coll.SetSerializer(new ProxyGeneratorSerializer(ret.Id, g.proxygen)); } #endregion proxygen #region globalvariables if (g.globalvariables != null) { foreach (var item in g.globalvariables) { ret.GlobalVariables.Add(new GlobalVariable { Name = item.name, Value = item.value, DefaultValue = item.value }); } } #endregion globalvariables #region hash #endregion hash return(ret); }
public void ReplaceSound(GameSound sound, string filename) { throw new NotImplementedException(); }
/// <summary> /// Plays a sound which is centred on this instance and triggers a specified callback when the sound completes /// </summary> /// <param name="gameObject">The gameobject to attach the sound to</param> /// <param name="gameSound">Sets which sound to play</param> /// <param name="callback">The routine to call when the sound finishes playing</param> public static void PlaySoundWithCallback(this IGameObject gameObject, GameSound gameSound, EventHandler callback) { GlobalServices.SoundPlayer.PlayForObjectWithCallback(gameSound, gameObject, GlobalServices.CentrePointProvider, callback); }
public SoundEffectFinishedEventArgs(GameSound gameSound) { this.GameSound = gameSound; }
public void Play(GameSound gameSound) { SoundEffect soundEffect = this._soundLibrary[gameSound]; soundEffect.Play(); }
public IGameSoundInstance GetSoundEffectInstance(GameSound gameSound) { var result = new NullGameSoundInstance(); return result; }