예제 #1
0
파일: Tasks.cs 프로젝트: onitake/ags
 private void AppendAudioClipsToHeader(StringBuilder sb, AudioClipFolder clips)
 {
     foreach (AudioClip clip in clips.AllItemsFlat)
     {
         sb.AppendLine("import AudioClip " + clip.ScriptName + ";");
     }
 }
예제 #2
0
        private void AppendAudioClipsToHeader(StringBuilder sb, AudioClipFolder clips)
        {
            foreach (AudioClip clip in clips.Items)
            {
                sb.AppendLine("import AudioClip " + clip.ScriptName + ";");
            }

            foreach (AudioClipFolder subFolder in clips.SubFolders)
            {
                AppendAudioClipsToHeader(sb, subFolder);
            }
        }
예제 #3
0
 private static IEnumerable<string> YieldAudioClipScriptNames(AudioClipFolder folder)
 {
     foreach (AudioClip clip in folder.Items)
     {
         yield return clip.ScriptName;
     }
     foreach (AudioClipFolder subfolder in folder.SubFolders)
     {
         foreach (string scriptname in YieldAudioClipScriptNames(subfolder))
         {
             yield return scriptname;
         }
     }
 }
예제 #4
0
파일: Game.cs 프로젝트: StormyDay/ags
        public Game()
        {
            _guis = new GUIFolder(GUIFolder.MAIN_GUI_FOLDER_NAME);
            _inventoryItems = new InventoryItemFolder(InventoryItemFolder.MAIN_INVENTORY_ITEM_FOLDER_NAME);
            _cursors = new List<MouseCursor>();
            _dialogs = new DialogFolder(DialogFolder.MAIN_DIALOG_FOLDER_NAME);
            _fonts = new List<Font>();
            _characters = new CharacterFolder(CharacterFolder.MAIN_CHARACTER_FOLDER_NAME);
            _plugins = new List<Plugin>();
            _translations = new List<Translation>();
            _rooms = new UnloadedRoomFolder(UnloadedRoomFolder.MAIN_UNLOADED_ROOM_FOLDER_NAME);
            _oldInteractionVariables = new List<OldInteractionVariable>();
            _settings = new Settings();
            _palette = new PaletteEntry[PALETTE_SIZE];
            _sprites = new SpriteFolder("Main");
            _views = new ViewFolder("Main");
            _audioClips = new AudioClipFolder("Main");
            _audioClipTypes = new List<AudioClipType>();
            _textParser = new TextParser();
            _lipSync = new LipSync();
            _propertySchema = new CustomPropertySchema();
            _globalVariables = new GlobalVariables();
            _globalMessages = new string[NUMBER_OF_GLOBAL_MESSAGES];
            _deletedViewIDs = new Dictionary<int, object>();
            _scripts = new ScriptFolder(ScriptFolder.MAIN_SCRIPT_FOLDER_NAME);
            _scriptsToCompile = new Scripts();
            ScriptAndHeader globalScript = new ScriptAndHeader(
                new Script(Script.GLOBAL_HEADER_FILE_NAME, "// script header\r\n", true),
                new Script(Script.GLOBAL_SCRIPT_FILE_NAME, "// global script\r\n", false));
            _scripts.Items.Add(globalScript);
            _playerCharacter = null;

            for (int i = 0; i < _globalMessages.Length; i++)
            {
                _globalMessages[i] = string.Empty;
            }

            InitializeDefaultPalette();
        }
예제 #5
0
파일: Game.cs 프로젝트: sonneveld/agscj
        public Game()
        {
            _guis = new List<GUI>();
            _inventoryItems = new List<InventoryItem>();
            _cursors = new List<MouseCursor>();
            _dialogs = new List<Dialog>();
            _fonts = new List<Font>();
            _characters = new List<Character>();
            _plugins = new List<Plugin>();
            _translations = new List<Translation>();
            _rooms = new RoomList();
            _oldInteractionVariables = new List<OldInteractionVariable>();
            _settings = new Settings();
            _palette = new PaletteEntry[PALETTE_SIZE];
            _sprites = new SpriteFolder("Main");
            _views = new ViewFolder("Main");
            _audioClips = new AudioClipFolder("Main");
            _audioClipTypes = new List<AudioClipType>();
            _textParser = new TextParser();
            _lipSync = new LipSync();
            _propertySchema = new CustomPropertySchema();
            _globalVariables = new GlobalVariables();
            _globalMessages = new string[NUMBER_OF_GLOBAL_MESSAGES];
            _deletedViewIDs = new Dictionary<int, object>();
            _scripts = new Scripts();
            _scriptsToCompile = new Scripts();
            _scripts.Add(new Script(Script.GLOBAL_HEADER_FILE_NAME, "// script header\r\n", true));
            _scripts.Add(new Script(Script.GLOBAL_SCRIPT_FILE_NAME, "// global script\r\n", false));
            _playerCharacter = null;

            for (int i = 0; i < _globalMessages.Length; i++)
            {
                _globalMessages[i] = string.Empty;
            }

            InitializeDefaultPalette();
        }
예제 #6
0
파일: Tasks.cs 프로젝트: smarinel/ags-web
        private void AppendAudioClipsToHeader(StringBuilder sb, AudioClipFolder clips)
        {
            foreach (AudioClip clip in clips.Items)
            {
                sb.AppendLine("import AudioClip " + clip.ScriptName + ";");
            }

            foreach (AudioClipFolder subFolder in clips.SubFolders)
            {
                AppendAudioClipsToHeader(sb, subFolder);
            }
        }
예제 #7
0
파일: Game.cs 프로젝트: StormyDay/ags
        public void FromXml(XmlNode node)
        {
            node = node.SelectSingleNode("Game");

            _settings.FromXml(node);
            _lipSync.FromXml(node);
            _propertySchema.FromXml(node);

            if (node.SelectSingleNode("InventoryHotspotMarker") != null)
            {
                // Pre-3.0.3
                InventoryHotspotMarker marker = new InventoryHotspotMarker();
                marker.FromXml(node);
                _settings.InventoryHotspotMarker = marker;
            }

            foreach (XmlNode msgNode in SerializeUtils.GetChildNodes(node, "GlobalMessages"))
            {
                _globalMessages[Convert.ToInt32(msgNode.Attributes["ID"].InnerText) - GLOBAL_MESSAGE_ID_START] = msgNode.InnerText;
            }

            _plugins.Clear();
            foreach (XmlNode pluginNode in SerializeUtils.GetChildNodes(node, "Plugins"))
            {
                _plugins.Add(new Plugin(pluginNode));
            }

            _rooms = new UnloadedRoomFolder(node.SelectSingleNode("Rooms").FirstChild, node);

            _guis = new GUIFolder(node.SelectSingleNode("GUIs").FirstChild, node);

            _inventoryItems = new InventoryItemFolder(node.SelectSingleNode("InventoryItems").FirstChild, node);

            _textParser = new TextParser(node.SelectSingleNode("TextParser"));

            _characters = new CharacterFolder(node.SelectSingleNode("Characters").FirstChild, node);

            _playerCharacter = null;
            string playerCharText = SerializeUtils.GetElementString(node, "PlayerCharacter");
            if (playerCharText.Length > 0)
            {
                int playerCharID = Convert.ToInt32(playerCharText);
                foreach (Character character in RootCharacterFolder.AllItemsFlat)
                {
                    if (character.ID == playerCharID)
                    {
                        _playerCharacter = character;
                        break;
                    }
                }
            }

            _dialogs = new DialogFolder(node.SelectSingleNode("Dialogs").FirstChild, node);

            _cursors.Clear();
            foreach (XmlNode cursNode in SerializeUtils.GetChildNodes(node, "Cursors"))
            {
                _cursors.Add(new MouseCursor(cursNode));
            }

            _fonts.Clear();
            foreach (XmlNode fontNode in SerializeUtils.GetChildNodes(node, "Fonts"))
            {
                _fonts.Add(new Font(fontNode));
            }

            _palette = ReadPaletteFromXML(node);

            _sprites = new SpriteFolder(node.SelectSingleNode("Sprites").FirstChild);

            _views = new ViewFolder(node.SelectSingleNode("Views").FirstChild);

            _deletedViewIDs.Clear();
            if (node.SelectSingleNode("DeletedViews") != null)
            {
                foreach (XmlNode transNode in SerializeUtils.GetChildNodes(node, "DeletedViews"))
                {
                    _deletedViewIDs.Add(Convert.ToInt32(transNode.InnerText), null);
                }
            }

            _scripts = new ScriptFolder(node.SelectSingleNode("Scripts").FirstChild, node);

            if (node.SelectSingleNode("AudioClips") != null)
            {
                _audioClips = new AudioClipFolder(node.SelectSingleNode("AudioClips").FirstChild);
            }
            else
            {
                _audioClips = new AudioClipFolder("Main");
                _audioClips.DefaultPriority = AudioClipPriority.Normal;
                _audioClips.DefaultRepeat = InheritableBool.False;
                _audioClips.DefaultVolume = 100;
            }

            _audioClipTypes.Clear();
            if (node.SelectSingleNode("AudioClipTypes") != null)
            {
                foreach (XmlNode clipTypeNode in SerializeUtils.GetChildNodes(node, "AudioClipTypes"))
                {
                    _audioClipTypes.Add(new AudioClipType(clipTypeNode));
                }
            }

            _translations.Clear();
            if (node.SelectSingleNode("Translations") != null)
            {
                foreach (XmlNode transNode in SerializeUtils.GetChildNodes(node, "Translations"))
                {
                    _translations.Add(new Translation(transNode));
                }
            }

            if (node.SelectSingleNode("GlobalVariables") != null)
            {
                _globalVariables = new GlobalVariables(node.SelectSingleNode("GlobalVariables"));
            }
            else
            {
                _globalVariables = new GlobalVariables();
            }

            _oldInteractionVariables.Clear();
            if (node.SelectSingleNode("OldInteractionVariables") != null)
            {
                foreach (XmlNode varNode in SerializeUtils.GetChildNodes(node, "OldInteractionVariables"))
                {
                    _oldInteractionVariables.Add(new OldInteractionVariable(SerializeUtils.GetAttributeString(varNode, "Name"), SerializeUtils.GetAttributeInt(varNode, "Value")));
                }
            }

            if (_savedXmlVersionIndex == null)
            {
                // Pre-3.0.3, upgrade co-ordinates
                ConvertCoordinatesToNativeResolution();
            }
        }
예제 #8
0
파일: Game.cs 프로젝트: StormyDay/ags
        private bool IsNameUsedByAudioClip(string name, AudioClipFolder folderToCheck, object ignoreObject)
        {
            foreach (AudioClip clip in folderToCheck.Items)
            {
                if ((clip.ScriptName == name) && (clip != ignoreObject))
                {
                    return true;
                }
            }

            foreach (AudioClipFolder subFolder in folderToCheck.SubFolders)
            {
                if (IsNameUsedByAudioClip(name, subFolder, ignoreObject))
                {
                    return true;
                }
            }

            return false;
        }
예제 #9
0
파일: Tasks.cs 프로젝트: CisBetter/ags
 private void AppendAudioClipsToHeader(StringBuilder sb, AudioClipFolder clips)
 {
     foreach (AudioClip clip in clips.AllItemsFlat)
     {
         sb.AppendLine("import AudioClip " + clip.ScriptName + ";");
     }
 }
예제 #10
0
	private void _RefreshAssets()
	{
		clipItems.Clear();
		hierarchyItems.Clear();

		List<string> assetExtensions = new List<string>()	{ ".asset", };
		List<string> clipExtensions = new List<string>()	{ ".wav", ".aif", ".aiff", ".ogg", ".mp3", ".xm", ".mod", ".it", ".xm", };
		List<string> paths = new List<string>(128);

		// Add all Buses
		List<SECTR_AudioBus> buses = SECTR_Asset.GetAll<SECTR_AudioBus>(audioRootPath, assetExtensions, ref paths, false);
		for(int busIndex = 0; busIndex < buses.Count; ++busIndex)
		{
			SECTR_AudioBus bus = buses[busIndex];
			if(bus != null)
			{
				new TreeItem(this, bus, paths[busIndex]);
			}
		}

		// Add all Cues
		List<SECTR_AudioCue> cues = SECTR_Asset.GetAll<SECTR_AudioCue>(audioRootPath, assetExtensions, ref paths, false);
		for(int cueIndex = 0; cueIndex < cues.Count; ++cueIndex)
		{
			SECTR_AudioCue cue = cues[cueIndex];
			if(cue != null)
			{
				new TreeItem(this, cue, paths[cueIndex]);
			}
		}

		// Build the list of AudioClips
		SECTR_Asset.GetAll<AudioClip>(audioRootPath, clipExtensions, ref paths, true);
		for(int pathIndex = 0; pathIndex < paths.Count; ++pathIndex)
		{
			string path = paths[pathIndex];
			if(!string.IsNullOrEmpty(path))
			{
				string dirPath = "";
				string fileName = "";
				SECTR_Asset.SplitPath(path, out dirPath, out fileName);

				TreeItem item = new TreeItem((AudioImporter)AssetImporter.GetAtPath(path), path, fileName);

				AudioClipFolder folder;
				if(!clipItems.TryGetValue(dirPath, out folder))
				{
					folder = new AudioClipFolder();
					bool userExpanded = EditorPrefs.GetBool(expandedPrefPrefix + dirPath, false);
					folder.expanded = userExpanded;
					clipItems.Add(dirPath, folder);
				}
				folder.items.Add(item);
			}
		}
	}