Browse Source

Unified Fungus object spawning method

Moved Prefabs to Resources folders so they can be easily loaded using
Resources.Load
master
chrisgregan 10 years ago
parent
commit
f2786e7255
  1. 4
      Assets/Fungus/Camera/Editor/CameraMenuItems.cs
  2. 5
      Assets/Fungus/Camera/Prefabs.meta
  3. 9
      Assets/Fungus/Camera/Resources.meta
  4. 0
      Assets/Fungus/Camera/Resources/View.prefab
  5. 0
      Assets/Fungus/Camera/Resources/View.prefab.meta
  6. 39
      Assets/Fungus/Dialog/Editor/DialogMenuItems.cs
  7. 0
      Assets/Fungus/Dialog/Resources/AudioTag.prefab
  8. 0
      Assets/Fungus/Dialog/Resources/AudioTag.prefab.meta
  9. 0
      Assets/Fungus/Dialog/Resources/Character.prefab
  10. 0
      Assets/Fungus/Dialog/Resources/Character.prefab.meta
  11. 0
      Assets/Fungus/Dialog/Resources/EventSystem.prefab
  12. 0
      Assets/Fungus/Dialog/Resources/EventSystem.prefab.meta
  13. 0
      Assets/Fungus/Dialog/Resources/MenuDialog.prefab
  14. 0
      Assets/Fungus/Dialog/Resources/MenuDialog.prefab.meta
  15. 0
      Assets/Fungus/Dialog/Resources/SayDialog.prefab
  16. 0
      Assets/Fungus/Dialog/Resources/SayDialog.prefab.meta
  17. 0
      Assets/Fungus/Dialog/Resources/Tag.prefab
  18. 0
      Assets/Fungus/Dialog/Resources/Tag.prefab.meta
  19. 10
      Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs
  20. 5
      Assets/Fungus/Portrait/Prefabs.meta
  21. 7
      Assets/Fungus/Portrait/Resources/Stage.prefab
  22. 0
      Assets/Fungus/Portrait/Resources/Stage.prefab.meta
  23. 3
      Assets/Fungus/Portrait/Resources/StagePosition.prefab
  24. 0
      Assets/Fungus/Portrait/Resources/StagePosition.prefab.meta
  25. 8
      Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs
  26. 0
      Assets/Fungus/Sprite/Resources.meta
  27. 0
      Assets/Fungus/Sprite/Resources/ClickableSprite.prefab
  28. 0
      Assets/Fungus/Sprite/Resources/ClickableSprite.prefab.meta
  29. 0
      Assets/Fungus/Sprite/Resources/DragTargetSprite.prefab
  30. 0
      Assets/Fungus/Sprite/Resources/DragTargetSprite.prefab.meta
  31. 0
      Assets/Fungus/Sprite/Resources/DraggableSprite.prefab
  32. 0
      Assets/Fungus/Sprite/Resources/DraggableSprite.prefab.meta
  33. 0
      Assets/Fungus/Sprite/Resources/ParallaxSprite.prefab
  34. 0
      Assets/Fungus/Sprite/Resources/ParallaxSprite.prefab.meta

4
Assets/Fungus/Camera/Editor/CameraMenuItems.cs

@ -8,9 +8,9 @@ namespace Fungus
public class CameraMenuItems public class CameraMenuItems
{ {
[MenuItem("GameObject/Fungus/Camera/View")] [MenuItem("GameObject/Fungus/Camera/View")]
static void CreateBackground() static void CreateView()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Camera/Prefabs/View.prefab"); FungusScriptMenuItems.SpawnPrefab("View");
} }
} }

5
Assets/Fungus/Camera/Prefabs.meta

@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 10dcdae42763d4e44af47c20af580910
folderAsset: yes
DefaultImporter:
userData:

9
Assets/Fungus/Camera/Resources.meta

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 6cc28e50d85784bb3bb7aa82a3091385
folderAsset: yes
timeCreated: 1427468269
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

0
Assets/Fungus/Camera/Prefabs/View.prefab → Assets/Fungus/Camera/Resources/View.prefab

0
Assets/Fungus/Camera/Prefabs/View.prefab.meta → Assets/Fungus/Camera/Resources/View.prefab.meta

39
Assets/Fungus/Dialog/Editor/DialogMenuItems.cs

@ -12,68 +12,43 @@ namespace Fungus
[MenuItem("GameObject/Fungus/Dialog/Character")] [MenuItem("GameObject/Fungus/Dialog/Character")]
static void CreateCharacter() static void CreateCharacter()
{ {
GameObject go = Resources.Load<GameObject>("FungusCharacter"); FungusScriptMenuItems.SpawnPrefab("Character");
if (go != null)
{
GameObject spawnedGO = PrefabUtility.InstantiatePrefab(go) as GameObject;
spawnedGO.name = "Character";
}
} }
[MenuItem("GameObject/Fungus/Dialog/SayDialog")] [MenuItem("GameObject/Fungus/Dialog/SayDialog")]
static void CreateSayDialog() static void CreateSayDialog()
{ {
GameObject go = Resources.Load<GameObject>("FungusSayDialog"); FungusScriptMenuItems.SpawnPrefab("SayDialog");
if (go != null)
{
GameObject spawnedGO = PrefabUtility.InstantiatePrefab(go) as GameObject;
spawnedGO.name = "SayDialog";
}
} }
[MenuItem("GameObject/Fungus/Dialog/MenuDialog")] [MenuItem("GameObject/Fungus/Dialog/MenuDialog")]
static void CreateMenuDialog() static void CreateMenuDialog()
{ {
GameObject go = Resources.Load<GameObject>("FungusMenuDialog"); FungusScriptMenuItems.SpawnPrefab("MenuDialog");
if (go != null)
{
GameObject spawnedGO = PrefabUtility.InstantiatePrefab(go) as GameObject;
spawnedGO.name = "MenuDialog";
}
} }
[MenuItem("GameObject/Fungus/Dialog/Tag")] [MenuItem("GameObject/Fungus/Dialog/Tag")]
static void CreateTag() static void CreateTag()
{ {
GameObject go = Resources.Load<GameObject>("FungusTag"); FungusScriptMenuItems.SpawnPrefab("Tag");
if (go != null)
{
GameObject spawnedGO = PrefabUtility.InstantiatePrefab(go) as GameObject;
spawnedGO.name = "Tag";
}
} }
[MenuItem("GameObject/Fungus/Dialog/AudioTag")] [MenuItem("GameObject/Fungus/Dialog/AudioTag")]
static void CreateAudioTag() static void CreateAudioTag()
{ {
GameObject go = Resources.Load<GameObject>("FungusAudioTag"); FungusScriptMenuItems.SpawnPrefab("AudioTag");
if (go != null)
{
GameObject spawnedGO = PrefabUtility.InstantiatePrefab(go) as GameObject;
spawnedGO.name = "AudioTag";
}
} }
[MenuItem("GameObject/Fungus/Portrait/Stage")] [MenuItem("GameObject/Fungus/Portrait/Stage")]
static void CreateStage() static void CreateStage()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Portrait/Prefabs/Stage.prefab"); FungusScriptMenuItems.SpawnPrefab("Stage");
} }
[MenuItem("GameObject/Fungus/Portrait/StagePosition")] [MenuItem("GameObject/Fungus/Portrait/StagePosition")]
static void CreateStagePosition() static void CreateStagePosition()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Portrait/Prefabs/StagePosition.prefab"); FungusScriptMenuItems.SpawnPrefab("StagePosition");
} }
} }

0
Assets/Fungus/Dialog/Resources/FungusAudioTag.prefab → Assets/Fungus/Dialog/Resources/AudioTag.prefab

0
Assets/Fungus/Dialog/Resources/FungusAudioTag.prefab.meta → Assets/Fungus/Dialog/Resources/AudioTag.prefab.meta

0
Assets/Fungus/Dialog/Resources/FungusCharacter.prefab → Assets/Fungus/Dialog/Resources/Character.prefab

0
Assets/Fungus/Dialog/Resources/FungusCharacter.prefab.meta → Assets/Fungus/Dialog/Resources/Character.prefab.meta

0
Assets/Fungus/Dialog/Resources/FungusEventSystem.prefab → Assets/Fungus/Dialog/Resources/EventSystem.prefab

0
Assets/Fungus/Dialog/Resources/FungusEventSystem.prefab.meta → Assets/Fungus/Dialog/Resources/EventSystem.prefab.meta

0
Assets/Fungus/Dialog/Resources/FungusMenuDialog.prefab → Assets/Fungus/Dialog/Resources/MenuDialog.prefab

0
Assets/Fungus/Dialog/Resources/FungusMenuDialog.prefab.meta → Assets/Fungus/Dialog/Resources/MenuDialog.prefab.meta

0
Assets/Fungus/Dialog/Resources/FungusSayDialog.prefab → Assets/Fungus/Dialog/Resources/SayDialog.prefab

0
Assets/Fungus/Dialog/Resources/FungusSayDialog.prefab.meta → Assets/Fungus/Dialog/Resources/SayDialog.prefab.meta

0
Assets/Fungus/Dialog/Resources/FungusTag.prefab → Assets/Fungus/Dialog/Resources/Tag.prefab

0
Assets/Fungus/Dialog/Resources/FungusTag.prefab.meta → Assets/Fungus/Dialog/Resources/Tag.prefab.meta

10
Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs

@ -11,22 +11,18 @@ namespace Fungus
[MenuItem("GameObject/Fungus/Fungus Script")] [MenuItem("GameObject/Fungus/Fungus Script")]
static void CreateFungusScript() static void CreateFungusScript()
{ {
SpawnPrefab("Assets/Fungus/FungusScript/Resources/FungusScript.prefab"); SpawnPrefab("FungusScript");
} }
public static GameObject SpawnPrefab(string prefabFile) public static GameObject SpawnPrefab(string prefabName)
{ {
string prefabName = Path.GetFileNameWithoutExtension(prefabFile); GameObject prefab = Resources.Load<GameObject>(prefabName);
// This will only succeed if Fungus is located in the root folder of the project
GameObject prefab = Resources.LoadAssetAtPath(prefabFile, typeof(GameObject)) as GameObject;
if (prefab == null) if (prefab == null)
{ {
return null; return null;
} }
GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject; GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
go.name = prefabName;
Camera sceneCam = SceneView.currentDrawingSceneView.camera; Camera sceneCam = SceneView.currentDrawingSceneView.camera;

5
Assets/Fungus/Portrait/Prefabs.meta

@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: bc13409addc0175478468496602b7880
folderAsset: yes
DefaultImporter:
userData:

7
Assets/Fungus/Portrait/Prefabs/Stage.prefab → Assets/Fungus/Portrait/Resources/Stage.prefab

@ -44,7 +44,7 @@ GameObject:
- 4: {fileID: 410270} - 4: {fileID: 410270}
- 114: {fileID: 11410274} - 114: {fileID: 11410274}
m_Layer: 0 m_Layer: 0
m_Name: Stage m_Name: FungusStage
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -233,8 +233,8 @@ MonoBehaviour:
m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ignoreReversedGraphics: 1 m_IgnoreReversedGraphics: 1
blockingObjects: 0 m_BlockingObjects: 0
m_BlockingMask: m_BlockingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
@ -477,4 +477,3 @@ Prefab:
m_ParentPrefab: {fileID: 0} m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 110274} m_RootGameObject: {fileID: 110274}
m_IsPrefabParent: 1 m_IsPrefabParent: 1
m_IsExploded: 1

0
Assets/Fungus/Portrait/Prefabs/Stage.prefab.meta → Assets/Fungus/Portrait/Resources/Stage.prefab.meta

3
Assets/Fungus/Portrait/Prefabs/StagePosition.prefab → Assets/Fungus/Portrait/Resources/StagePosition.prefab

@ -11,7 +11,7 @@ GameObject:
- 222: {fileID: 22295640} - 222: {fileID: 22295640}
- 114: {fileID: 11495640} - 114: {fileID: 11495640}
m_Layer: 0 m_Layer: 0
m_Name: StagePosition m_Name: FungusStagePosition
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -72,4 +72,3 @@ Prefab:
m_ParentPrefab: {fileID: 0} m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 195640} m_RootGameObject: {fileID: 195640}
m_IsPrefabParent: 1 m_IsPrefabParent: 1
m_IsExploded: 1

0
Assets/Fungus/Portrait/Prefabs/StagePosition.prefab.meta → Assets/Fungus/Portrait/Resources/StagePosition.prefab.meta

8
Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs

@ -10,25 +10,25 @@ namespace Fungus
[MenuItem("GameObject/Fungus/Sprite/ClickableSprite")] [MenuItem("GameObject/Fungus/Sprite/ClickableSprite")]
static void CreateClickableSprite() static void CreateClickableSprite()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab"); FungusScriptMenuItems.SpawnPrefab("ClickableSprite");
} }
[MenuItem("GameObject/Fungus/Sprite/DraggableSprite")] [MenuItem("GameObject/Fungus/Sprite/DraggableSprite")]
static void CreateDraggableSprite() static void CreateDraggableSprite()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab"); FungusScriptMenuItems.SpawnPrefab("DraggableSprite");
} }
[MenuItem("GameObject/Fungus/Sprite/DragTargetSprite")] [MenuItem("GameObject/Fungus/Sprite/DragTargetSprite")]
static void CreateDragTargetSprite() static void CreateDragTargetSprite()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab"); FungusScriptMenuItems.SpawnPrefab("DragTargetSprite");
} }
[MenuItem("GameObject/Fungus/Sprite/ParallaxSprite")] [MenuItem("GameObject/Fungus/Sprite/ParallaxSprite")]
static void CreateParallaxSprite() static void CreateParallaxSprite()
{ {
FungusScriptMenuItems.SpawnPrefab("Assets/Fungus/Sprite/Prefabs/ParallaxSprite.prefab"); FungusScriptMenuItems.SpawnPrefab("ParallaxSprite");
} }
} }

0
Assets/Fungus/Sprite/Prefabs.meta → Assets/Fungus/Sprite/Resources.meta

0
Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab → Assets/Fungus/Sprite/Resources/ClickableSprite.prefab

0
Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta → Assets/Fungus/Sprite/Resources/ClickableSprite.prefab.meta

0
Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab → Assets/Fungus/Sprite/Resources/DragTargetSprite.prefab

0
Assets/Fungus/Sprite/Prefabs/DragTargetSprite.prefab.meta → Assets/Fungus/Sprite/Resources/DragTargetSprite.prefab.meta

0
Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab → Assets/Fungus/Sprite/Resources/DraggableSprite.prefab

0
Assets/Fungus/Sprite/Prefabs/DraggableSprite.prefab.meta → Assets/Fungus/Sprite/Resources/DraggableSprite.prefab.meta

0
Assets/Fungus/Sprite/Prefabs/ParallaxSprite.prefab → Assets/Fungus/Sprite/Resources/ParallaxSprite.prefab

0
Assets/Fungus/Sprite/Prefabs/ParallaxSprite.prefab.meta → Assets/Fungus/Sprite/Resources/ParallaxSprite.prefab.meta

Loading…
Cancel
Save