Browse Source

Merged UI redesign and iTween support branch

master
chrisgregan 10 years ago
parent
commit
385ef1a967
  1. 2
      Assets/Examples/JumpingPrax/Animations.meta
  2. 125
      Assets/Examples/JumpingPrax/JumpingPrax.unity
  3. BIN
      Assets/Examples/Template_CYOA/Background.png
  4. 50
      Assets/Examples/Template_CYOA/Background.png.meta
  5. 2986
      Assets/Examples/Template_CYOA/Scene.unity
  6. 4
      Assets/Examples/Template_CYOA/Scene.unity.meta
  7. 5
      Assets/Examples/Template_Empty.meta
  8. 331
      Assets/Examples/Template_Empty/Scene.unity
  9. 4
      Assets/Examples/Template_Empty/Scene.unity.meta
  10. 5
      Assets/Examples/Template_VisualNovel.meta
  11. 3460
      Assets/Examples/Template_VisualNovel/Scene.unity
  12. 4
      Assets/Examples/Template_VisualNovel/Scene.unity.meta
  13. 1235
      Assets/Examples/TheFacility/TheFacility.unity
  14. 905
      Assets/Examples/TheHunter/TheHunter.unity
  15. 38
      Assets/Examples/Usfxr/UsfxrAudioExample.unity
  16. 25
      Assets/Fungus/Camera/Editor/ViewEditor.cs
  17. 3
      Assets/Fungus/Dialog/Commands/AddOption.cs
  18. 18
      Assets/Fungus/Dialog/Commands/Choose.cs
  19. 34
      Assets/Fungus/Dialog/Commands/Say.cs
  20. 38
      Assets/Fungus/Dialog/Commands/SetChooseDialog.cs
  21. 38
      Assets/Fungus/Dialog/Commands/SetSayDialog.cs
  22. 13
      Assets/Fungus/Dialog/Editor/ChooseEditor.cs
  23. 13
      Assets/Fungus/Dialog/Editor/SayEditor.cs
  24. 33
      Assets/Fungus/Dialog/Editor/SetChooseDialogEditor.cs
  25. 34
      Assets/Fungus/Dialog/Editor/SetSayDialogEditor.cs
  26. 4
      Assets/Fungus/FungusScript/Commands/Comment.cs
  27. 2
      Assets/Fungus/FungusScript/Commands/Comment.cs.meta
  28. 8
      Assets/Fungus/FungusScript/Commands/Note.cs.meta
  29. 8
      Assets/Fungus/FungusScript/Editor/CommandEditor.cs
  30. 189
      Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs
  31. 79
      Assets/Fungus/FungusScript/Editor/EditorZoomArea.cs
  32. 2
      Assets/Fungus/FungusScript/Editor/EditorZoomArea.cs.meta
  33. 122
      Assets/Fungus/FungusScript/Editor/FungusEditorResources.cs
  34. 2
      Assets/Fungus/FungusScript/Editor/FungusEditorResources.cs.meta
  35. 28
      Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs
  36. 4
      Assets/Fungus/FungusScript/Editor/FungusScriptMenuItems.cs
  37. 677
      Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs
  38. 13
      Assets/Fungus/FungusScript/Editor/GLDraw.cs
  39. 323
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs
  40. 17
      Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs
  41. 9
      Assets/Fungus/FungusScript/Scripts/Command.cs
  42. 27
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs
  43. 9
      Assets/Fungus/FungusScript/Scripts/SceneLoader.cs
  44. 4
      Assets/Fungus/FungusScript/Scripts/Sequence.cs
  45. 2
      Assets/Fungus/iTween.meta
  46. 29
      Assets/Fungus/iTween/MoveAdd.cs
  47. 2
      Assets/Fungus/iTween/MoveAdd.cs.meta
  48. 29
      Assets/Fungus/iTween/MoveTo.cs
  49. 8
      Assets/Fungus/iTween/MoveTo.cs.meta
  50. 29
      Assets/Fungus/iTween/PunchPosition.cs
  51. 8
      Assets/Fungus/iTween/PunchPosition.cs.meta
  52. 29
      Assets/Fungus/iTween/PunchRotation.cs
  53. 8
      Assets/Fungus/iTween/PunchRotation.cs.meta
  54. 27
      Assets/Fungus/iTween/PunchScale.cs
  55. 8
      Assets/Fungus/iTween/PunchScale.cs.meta
  56. 29
      Assets/Fungus/iTween/RotateAdd.cs
  57. 8
      Assets/Fungus/iTween/RotateAdd.cs.meta
  58. 29
      Assets/Fungus/iTween/RotateTo.cs
  59. 8
      Assets/Fungus/iTween/RotateTo.cs.meta
  60. 27
      Assets/Fungus/iTween/ScaleAdd.cs
  61. 8
      Assets/Fungus/iTween/ScaleAdd.cs.meta
  62. 27
      Assets/Fungus/iTween/ScaleTo.cs
  63. 8
      Assets/Fungus/iTween/ScaleTo.cs.meta
  64. 62
      Assets/Fungus/iTween/iTweenCommand.cs
  65. 8
      Assets/Fungus/iTween/iTweenCommand.cs.meta

2
Assets/Examples/JumpingPrax/Animations.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 37f6810dcd8fa44b1b2b28c87d4368be
guid: 1112e45b49be2428080ec04d3ff9e911
folderAsset: yes
DefaultImporter:
userData:

125
Assets/Examples/JumpingPrax/JumpingPrax.unity

@ -230,11 +230,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name:
m_EditorClassIdentifier:
scriptScrollPos: {x: 0, y: 0}
commandScrollPos: {x: 0, y: 0}
commandViewWidth: 350
selectedSequence: {fileID: 1947290628}
selectedCommand: {fileID: 0}
scrollPos: {x: 436.026611, y: 460.028076}
scrollViewRect:
serializedVersion: 2
x: -1049
y: -608
width: 2140
height: 1416
selectedSequence: {fileID: 0}
selectedCommands: []
variables:
- {fileID: 16019625}
startSequence: {fileID: 1947290628}
@ -243,7 +247,7 @@ MonoBehaviour:
runSlowInEditor: 1
runSlowDuration: .25
colorCommands: 1
hideSequenceObjects: 1
hideComponents: 1
--- !u!4 &16019624
Transform:
m_ObjectHideFlags: 0
@ -882,11 +886,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: -154
y: 108
width: 100
height: 40
description:
x: -630
y: -139
width: 240
height: 167
sequenceName: StopJumping
commandList:
- {fileID: 418947481}
- {fileID: 418947482}
@ -896,7 +900,7 @@ MonoBehaviour:
- {fileID: 418947483}
--- !u!114 &418947480
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 418947477}
@ -907,7 +911,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
animator: {fileID: 2120294220}
parameterName: AmIJumping
value:
@ -915,7 +918,7 @@ MonoBehaviour:
booleanValue: 0
--- !u!114 &418947481
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 418947477}
@ -926,14 +929,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
storyText: But I don't wanna stop!
character: {fileID: 1844806518}
voiceOverClip: {fileID: 0}
showOnce: 0
--- !u!114 &418947482
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 418947477}
@ -944,7 +946,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
variable: {fileID: 16019625}
setOperator: 0
booleanData:
@ -961,7 +962,7 @@ MonoBehaviour:
stringValue:
--- !u!114 &418947483
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 418947477}
@ -972,11 +973,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
targetSequence: {fileID: 1059081933}
--- !u!114 &418947484
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 418947477}
@ -987,11 +987,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
duration: 2
--- !u!114 &418947485
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 418947477}
@ -1002,7 +1001,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
duration: 4
--- !u!1 &492670789
GameObject:
@ -1904,17 +1902,17 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 40
y: 104
width: 100
height: 40
description:
x: -52
y: -75
width: 240
height: 87
sequenceName: BackToTheStart
commandList:
- {fileID: 1059081935}
- {fileID: 1059081934}
--- !u!114 &1059081934
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1059081931}
@ -1925,11 +1923,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
targetSequence: {fileID: 1947290628}
--- !u!114 &1059081935
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1059081931}
@ -1940,7 +1937,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
storyText: OK, back to the start!
character: {fileID: 1844806518}
voiceOverClip: {fileID: 0}
@ -3257,7 +3253,7 @@ GameObject:
m_IsActive: 1
--- !u!114 &1947290627
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3268,7 +3264,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
storyText: I don't need shoes, I don't even have feet!
character: {fileID: 1844806518}
voiceOverClip: {fileID: 0}
@ -3286,11 +3281,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: -45
y: -9
width: 100
height: 40
description:
x: -322
y: 1
width: 240
height: 407
sequenceName: Start
commandList:
- {fileID: 1947290641}
- {fileID: 1947290640}
@ -3312,7 +3307,7 @@ MonoBehaviour:
- {fileID: 1947290636}
--- !u!114 &1947290629
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3323,14 +3318,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
storyText: I can't find my shoes anywhere!
character: {fileID: 102763371}
voiceOverClip: {fileID: 0}
showOnce: 0
--- !u!114 &1947290630
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3341,7 +3335,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
sayDialog: {fileID: 1426510413}
--- !u!4 &1947290631
Transform:
@ -3357,7 +3350,7 @@ Transform:
m_RootOrder: 0
--- !u!114 &1947290632
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3368,13 +3361,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
optionText: Stop jumping
targetSequence: {fileID: 418947479}
hideOnSelected: 0
--- !u!114 &1947290633
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3385,13 +3377,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
duration: .5
targetView: {fileID: 953757}
waitUntilFinished: 0
--- !u!114 &1947290634
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3402,13 +3393,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
optionText: Go back to the start
targetSequence: {fileID: 1059081933}
hideOnSelected: 0
--- !u!114 &1947290635
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3419,14 +3409,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
storyText: Wait a second...
character: {fileID: 1871969526}
voiceOverClip: {fileID: 0}
showOnce: 0
--- !u!114 &1947290636
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3437,14 +3426,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
storyText: You took too long!
character: {fileID: 0}
voiceOverClip: {fileID: 0}
showOnce: 0
--- !u!114 &1947290637
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3455,14 +3443,13 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
chooseText:
character: {fileID: 0}
voiceOverClip: {fileID: 0}
timeoutDuration: 5
--- !u!114 &1947290638
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3473,11 +3460,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
chooseDialog: {fileID: 2060983701}
--- !u!114 &1947290639
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3488,12 +3474,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
volume: .419999987
fadeDuration: 7.19999981
--- !u!114 &1947290640
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3504,11 +3489,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
musicClip: {fileID: 8300000, guid: 19f33067513db4e9cb3a36d5c984bba7, type: 3}
atTime: 0
--- !u!114 &1947290641
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3519,7 +3504,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
duration: 1
targetView: {fileID: 1261834500}
waitUntilFinished: 1
@ -3527,7 +3511,7 @@ MonoBehaviour:
fadeTexture: {fileID: 0}
--- !u!114 &1947290642
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3538,7 +3522,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
variable: {fileID: 16019625}
setOperator: 0
booleanData:
@ -3555,7 +3538,7 @@ MonoBehaviour:
stringValue:
--- !u!114 &1947290643
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3566,7 +3549,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
variable: {fileID: 16019625}
setOperator: 0
booleanData:
@ -3583,7 +3565,7 @@ MonoBehaviour:
stringValue:
--- !u!114 &1947290644
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3594,7 +3576,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
animator: {fileID: 2120294220}
parameterName: AmIJumping
value:
@ -3602,7 +3583,7 @@ MonoBehaviour:
booleanValue: 0
--- !u!114 &1947290645
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3613,7 +3594,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
animator: {fileID: 2120294220}
parameterName: AmIJumping
value:
@ -3621,7 +3601,7 @@ MonoBehaviour:
booleanValue: 0
--- !u!114 &1947290646
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
@ -3632,7 +3612,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
variable: {fileID: 16019625}
setOperator: 0
booleanData:

BIN
Assets/Examples/Template_CYOA/Background.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

50
Assets/Examples/Template_CYOA/Background.png.meta

@ -1,50 +0,0 @@
fileFormatVersion: 2
guid: 757b68d7ca1c74b2eb40fba9b871b6b1
TextureImporter:
fileIDToRecycleName:
21300000: Vignette
21300002: Vignette 1
21300004: Background
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:

2986
Assets/Examples/Template_CYOA/Scene.unity

File diff suppressed because it is too large Load Diff

4
Assets/Examples/Template_CYOA/Scene.unity.meta

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: a558a8e18d2ad46de8bf9b8b860ded45
DefaultImporter:
userData:

5
Assets/Examples/Template_Empty.meta

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

331
Assets/Examples/Template_Empty/Scene.unity

@ -1,331 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 0}
m_ObjectHideFlags: 0
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
m_LightProbes: {fileID: 0}
m_Lightmaps: []
m_LightmapsMode: 1
m_BakedColorSpace: 0
m_UseDualLightmapsInForward: 0
m_LightmapEditorSettings:
m_Resolution: 50
m_LastUsedResolution: 0
m_TextureWidth: 1024
m_TextureHeight: 1024
m_BounceBoost: 1
m_BounceIntensity: 1
m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1}
m_SkyLightIntensity: 0
m_Quality: 0
m_Bounces: 1
m_FinalGatherRays: 1000
m_FinalGatherContrastThreshold: .0500000007
m_FinalGatherGradientThreshold: 0
m_FinalGatherInterpolationPoints: 15
m_AOAmount: 0
m_AOMaxDistance: .100000001
m_AOContrast: 1
m_LODSurfaceMappingDistance: 1
m_Padding: 0
m_TextureCompression: 0
m_LockAtlas: 0
--- !u!196 &5
NavMeshSettings:
m_ObjectHideFlags: 0
m_BuildSettings:
agentRadius: .5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
widthInaccuracy: 16.666666
heightInaccuracy: 10
m_NavMesh: {fileID: 0}
--- !u!1 &16019622
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 16019624}
- 114: {fileID: 16019623}
m_Layer: 0
m_Name: FungusScript
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &16019623
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 16019622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name:
m_EditorClassIdentifier:
scriptScrollPos: {x: 0, y: 0}
commandScrollPos: {x: 0, y: 0}
commandViewWidth: 350
selectedSequence: {fileID: 1947290628}
selectedCommand: {fileID: 0}
variables: []
startSequence: {fileID: 1947290628}
executeOnStart: 1
settings:
runSlowInEditor: 1
runSlowDuration: .25
colorCommands: 1
hideSequenceObjects: 1
--- !u!4 &16019624
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 16019622}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.83909988, y: 1.30620003, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1947290631}
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!1 &171864907
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 171864911}
- 114: {fileID: 171864910}
- 114: {fileID: 171864909}
- 114: {fileID: 171864908}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &171864908
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 171864907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AllowActivationOnStandalone: 0
--- !u!114 &171864909
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 171864907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_AllowActivationOnMobileDevice: 0
--- !u!114 &171864910
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 171864907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
--- !u!4 &171864911
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 171864907}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
--- !u!1 &637969834
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 637969839}
- 20: {fileID: 637969838}
- 92: {fileID: 637969837}
- 124: {fileID: 637969836}
- 81: {fileID: 637969835}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &637969835
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 637969834}
m_Enabled: 1
--- !u!124 &637969836
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 637969834}
m_Enabled: 1
--- !u!92 &637969837
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 637969834}
m_Enabled: 1
--- !u!20 &637969838
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 637969834}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 2.48888779
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
--- !u!4 &637969839
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 637969834}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!1 &1947290626
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1947290631}
- 114: {fileID: 1947290628}
m_Layer: 0
m_Name: Start
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1947290628
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3}
m_Name:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: -43
y: -9
width: 100
height: 40
description: This is the start of your Fungus scene.
commandList: []
--- !u!4 &1947290631
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1947290626}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 16019624}
m_RootOrder: 0

4
Assets/Examples/Template_Empty/Scene.unity.meta

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: d2460a389a4e84011b52012f3f2fa8bb
DefaultImporter:
userData:

5
Assets/Examples/Template_VisualNovel.meta

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

3460
Assets/Examples/Template_VisualNovel/Scene.unity

File diff suppressed because it is too large Load Diff

4
Assets/Examples/Template_VisualNovel/Scene.unity.meta

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: b73f12587e4454c1898abd60bec2fcab
DefaultImporter:
userData:

1235
Assets/Examples/TheFacility/TheFacility.unity

File diff suppressed because it is too large Load Diff

905
Assets/Examples/TheHunter/TheHunter.unity

File diff suppressed because it is too large Load Diff

38
Assets/Examples/Usfxr/UsfxrAudioExample.unity

@ -198,7 +198,7 @@ GameObject:
m_IsActive: 1
--- !u!114 &1295658134
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1295658133}
@ -209,12 +209,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
ParentTransform: {fileID: 0}
SettingsString: 0,.5,,.0004,.354,.414,.3,.731,,,,,,,,,,,,,,,,,,1,,,,,,
--- !u!114 &1295658135
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1295658133}
@ -225,7 +224,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
ParentTransform: {fileID: 0}
SettingsString: 1,.5,,.1749,.0094,.2571,.3,.6665,.2,-.2852,,,,,,,,,,,.2159,.1001,,.1209,-.1511,1,,,,,,
--- !u!114 &1295658136
@ -241,11 +239,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 0
y: 0
width: 110
height: 40
description:
x: -91
y: -438
width: 240
height: 127
sequenceName: Sound Sequence
commandList:
- {fileID: 1295658134}
- {fileID: 1295658138}
@ -265,7 +263,7 @@ Transform:
m_RootOrder: 0
--- !u!114 &1295658138
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1295658133}
@ -276,12 +274,11 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
ParentTransform: {fileID: 0}
SettingsString: 1,.5,,.142,,.1233,.3,.4328,,,,,,,,,,,,,,,,,,1,,,.1,,,
--- !u!114 &1295658139
MonoBehaviour:
m_ObjectHideFlags: 1
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1295658133}
@ -292,7 +289,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
selected: 0
ParentTransform: {fileID: 0}
SettingsString: 0,.5,,.0259,.3178,.2433,.3,.7694,,,,,,,,,.4286,.673,,,,,,,,1,,,,,,
--- !u!1 &1457713101
@ -328,7 +324,7 @@ MonoBehaviour:
y: 10
width: 100
height: 40
description:
sequenceName: New Sequence
commandList: []
--- !u!4 &1457713103
Transform:
@ -382,11 +378,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name:
m_EditorClassIdentifier:
scriptScrollPos: {x: 87.5, y: 0}
commandScrollPos: {x: 0, y: 0}
commandViewWidth: 350
scrollPos: {x: 158.009644, y: 294.017944}
scrollViewRect:
serializedVersion: 2
x: -547
y: -838
width: 1187
height: 1365
selectedSequence: {fileID: 1295658136}
selectedCommand: {fileID: 1295658139}
selectedCommands: []
variables: []
startSequence: {fileID: 1295658136}
executeOnStart: 1
@ -394,4 +394,4 @@ MonoBehaviour:
runSlowInEditor: 1
runSlowDuration: .25
colorCommands: 1
hideSequenceObjects: 1
hideComponents: 1

25
Assets/Fungus/Camera/Editor/ViewEditor.cs

@ -162,16 +162,23 @@ namespace Fungus
FungusScript fungusScript = FungusScriptWindow.GetFungusScript();
if (fungusScript != null)
{
MoveToView moveToViewCommand = fungusScript.selectedCommand as MoveToView;
if (moveToViewCommand != null)
foreach (Command command in fungusScript.selectedCommands)
{
highlight = (moveToViewCommand.targetView == view);
}
FadeToView fadeToViewCommand = fungusScript.selectedCommand as FadeToView;
if (fadeToViewCommand != null)
{
highlight = (fadeToViewCommand.targetView == view);
MoveToView moveToViewCommand = command as MoveToView;
if (moveToViewCommand != null &&
moveToViewCommand.targetView == view)
{
highlight = true;
}
else
{
FadeToView fadeToViewCommand = command as FadeToView;
if (fadeToViewCommand != null &&
fadeToViewCommand.targetView == view)
{
highlight = true;
}
}
}
}

3
Assets/Fungus/Dialog/Commands/AddOption.cs

@ -17,8 +17,7 @@ namespace Fungus
public override void OnEnter()
{
if (hideOnSelected &&
targetSequence.GetExecutionCount() > 0)
if (targetSequence == null || (hideOnSelected && targetSequence.GetExecutionCount() > 0))
{
Continue();
return;

18
Assets/Fungus/Dialog/Commands/Choose.cs

@ -22,6 +22,7 @@ namespace Fungus
public string chooseText;
public Character character;
public ChooseDialog chooseDialog;
public AudioClip voiceOverClip;
public float timeoutDuration;
@ -29,13 +30,12 @@ namespace Fungus
public override void OnEnter()
{
ChooseDialog dialog = SetChooseDialog.activeDialog;
showBasicGUI = false;
if (dialog == null)
if (chooseDialog == null)
{
// Try to get any SayDialog in the scene
dialog = GameObject.FindObjectOfType<ChooseDialog>();
if (dialog == null)
chooseDialog = GameObject.FindObjectOfType<ChooseDialog>();
if (chooseDialog == null)
{
showBasicGUI = true;
return;
@ -48,8 +48,8 @@ namespace Fungus
}
else
{
dialog.ShowDialog(true);
dialog.SetCharacter(character);
chooseDialog.ShowDialog(true);
chooseDialog.SetCharacter(character);
List<ChooseDialog.Option> dialogOptions = new List<ChooseDialog.Option>();
foreach (Option option in options)
@ -60,7 +60,7 @@ namespace Fungus
dialogOption.onSelect = delegate {
dialog.ShowDialog(false);
chooseDialog.ShowDialog(false);
if (onSelectSequence == null)
{
@ -82,8 +82,8 @@ namespace Fungus
MusicController.GetInstance().PlaySound(voiceOverClip, 1f);
}
dialog.Choose(chooseText, dialogOptions, timeoutDuration, delegate {
dialog.ShowDialog(false);
chooseDialog.Choose(chooseText, dialogOptions, timeoutDuration, delegate {
chooseDialog.ShowDialog(false);
Continue();
});
}

34
Assets/Fungus/Dialog/Commands/Say.cs

@ -14,6 +14,7 @@ namespace Fungus
public string storyText;
public Character character;
public SayDialog sayDialog;
public AudioClip voiceOverClip;
public bool showOnce;
protected int executionCount;
@ -29,30 +30,29 @@ namespace Fungus
executionCount++;
SayDialog dialog = SetSayDialog.activeDialog;
showBasicGUI = false;
if (dialog == null)
if (sayDialog == null)
{
// Try to get any SayDialog in the scene
dialog = GameObject.FindObjectOfType<SayDialog>();
if (dialog == null)
sayDialog = GameObject.FindObjectOfType<SayDialog>();
if (sayDialog == null)
{
showBasicGUI = true;
return;
}
}
dialog.SetCharacter(character);
sayDialog.SetCharacter(character);
dialog.ShowDialog(true);
sayDialog.ShowDialog(true);
if (voiceOverClip != null)
{
MusicController.GetInstance().PlaySound(voiceOverClip, 1f);
}
dialog.Say(storyText, delegate {
dialog.ShowDialog(false);
sayDialog.Say(storyText, delegate {
sayDialog.ShowDialog(false);
Continue();
});
}
@ -106,6 +106,24 @@ namespace Fungus
{
return new Color32(184, 210, 235, 255);
}
public override void OnCommandAdded(Sequence parentSequence)
{
// Find last Say command in the sequence, then copy the Say dialog it's using.
// This saves a step when adding a new Say command
for (int i = parentSequence.commandList.Count - 1; i >= 0; --i)
{
Say sayCommand = parentSequence.commandList[i] as Say;
if (sayCommand != null)
{
if (sayCommand.sayDialog != null)
{
sayDialog = sayCommand.sayDialog;
break;
}
}
}
}
}
}

38
Assets/Fungus/Dialog/Commands/SetChooseDialog.cs

@ -1,38 +0,0 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
[CommandInfo("Dialog",
"Set Choose Dialog",
"Sets the active dialog to use for displaying story text with the Choose command.")]
public class SetChooseDialog : Command
{
public ChooseDialog chooseDialog;
static public ChooseDialog activeDialog;
public override void OnEnter()
{
activeDialog = chooseDialog;
Continue();
}
public override string GetSummary()
{
if (chooseDialog == null)
{
return "Error: No dialog selected";
}
return chooseDialog.name;
}
public override Color GetButtonColor()
{
return new Color32(184, 210, 235, 255);
}
}
}

38
Assets/Fungus/Dialog/Commands/SetSayDialog.cs

@ -1,38 +0,0 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
[CommandInfo("Dialog",
"Set Say Dialog",
"Sets the active dialog to use for displaying story text with the Say command.")]
public class SetSayDialog : Command
{
public SayDialog sayDialog;
static public SayDialog activeDialog;
public override void OnEnter()
{
activeDialog = sayDialog;
Continue();
}
public override string GetSummary()
{
if (sayDialog == null)
{
return "Error: No dialog selected";
}
return sayDialog.name;
}
public override Color GetButtonColor()
{
return new Color32(184, 210, 235, 255);
}
}
}

13
Assets/Fungus/Dialog/Editor/ChooseEditor.cs

@ -15,6 +15,7 @@ namespace Fungus
protected SerializedProperty chooseTextProp;
protected SerializedProperty characterProp;
protected SerializedProperty chooseDialogProp;
protected SerializedProperty voiceOverClipProp;
protected SerializedProperty timeoutDurationProp;
@ -22,6 +23,7 @@ namespace Fungus
{
chooseTextProp = serializedObject.FindProperty("chooseText");
characterProp = serializedObject.FindProperty("character");
chooseDialogProp = serializedObject.FindProperty("chooseDialog");
voiceOverClipProp = serializedObject.FindProperty("voiceOverClip");
timeoutDurationProp = serializedObject.FindProperty("timeoutDuration");
}
@ -67,9 +69,14 @@ namespace Fungus
EditorGUILayout.Separator();
CommandEditor.ObjectField<Character>(characterProp,
new GUIContent("Character", "Character to display in dialog"),
new GUIContent("<None>"),
Character.activeCharacters);
new GUIContent("Character", "Character to display in dialog"),
new GUIContent("<None>"),
Character.activeCharacters);
CommandEditor.ObjectField<ChooseDialog>(chooseDialogProp,
new GUIContent("Choose Dialog", "Choose Dialog object to use to display the multiple player choices"),
new GUIContent("<None>"),
ChooseDialog.activeDialogs);
EditorGUILayout.PropertyField(voiceOverClipProp, new GUIContent("Voice Over Clip", "Voice over audio to play when the choose text is displayed"));

13
Assets/Fungus/Dialog/Editor/SayEditor.cs

@ -32,6 +32,7 @@ namespace Fungus
protected SerializedProperty storyTextProp;
protected SerializedProperty characterProp;
protected SerializedProperty sayDialogProp;
protected SerializedProperty voiceOverClipProp;
protected SerializedProperty showOnceProp;
@ -39,6 +40,7 @@ namespace Fungus
{
storyTextProp = serializedObject.FindProperty("storyText");
characterProp = serializedObject.FindProperty("character");
sayDialogProp = serializedObject.FindProperty("sayDialog");
voiceOverClipProp = serializedObject.FindProperty("voiceOverClip");
showOnceProp = serializedObject.FindProperty("showOnce");
}
@ -84,9 +86,14 @@ namespace Fungus
EditorGUILayout.Separator();
CommandEditor.ObjectField<Character>(characterProp,
new GUIContent("Character", "Character to display in dialog"),
new GUIContent("<None>"),
Character.activeCharacters);
new GUIContent("Character", "Character to display in dialog"),
new GUIContent("<None>"),
Character.activeCharacters);
CommandEditor.ObjectField<SayDialog>(sayDialogProp,
new GUIContent("Say Dialog", "Say Dialog object to use to display the story text"),
new GUIContent("<None>"),
SayDialog.activeDialogs);
EditorGUILayout.PropertyField(voiceOverClipProp,
new GUIContent("Voice Over Clip", "Voice over audio to play when the say text is displayed"));

33
Assets/Fungus/Dialog/Editor/SetChooseDialogEditor.cs

@ -1,33 +0,0 @@
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Rotorz.ReorderableList;
namespace Fungus
{
[CustomEditor (typeof(SetChooseDialog))]
public class SetChooseDialogEditor : CommandEditor
{
protected SerializedProperty chooseDialogProp;
protected virtual void OnEnable()
{
chooseDialogProp = serializedObject.FindProperty("chooseDialog");
}
public override void DrawCommandGUI()
{
serializedObject.Update();
CommandEditor.ObjectField<ChooseDialog>(chooseDialogProp,
new GUIContent("Choose Dialog", "Dialog to use when displaying options with the Choose command."),
new GUIContent("<None>"),
ChooseDialog.activeDialogs);
serializedObject.ApplyModifiedProperties();
}
}
}

34
Assets/Fungus/Dialog/Editor/SetSayDialogEditor.cs

@ -1,34 +0,0 @@
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Rotorz.ReorderableList;
namespace Fungus
{
[CustomEditor (typeof(SetSayDialog))]
public class SetSayDialogEditor : CommandEditor
{
protected SerializedProperty sayDialogProp;
protected virtual void OnEnable()
{
sayDialogProp = serializedObject.FindProperty("sayDialog");
}
public override void DrawCommandGUI()
{
serializedObject.Update();
CommandEditor.ObjectField<SayDialog>(sayDialogProp,
new GUIContent("Say Dialog", "Dialog to use when displaying Say command story text"),
new GUIContent("<None>"),
SayDialog.activeDialogs);
serializedObject.ApplyModifiedProperties();
}
}
}

4
Assets/Fungus/FungusScript/Commands/Note.cs → Assets/Fungus/FungusScript/Commands/Comment.cs

@ -5,9 +5,9 @@ using System.Collections.Generic;
namespace Fungus
{
[CommandInfo("Scripting",
"Note",
"Comment",
"Records design notes and reminders about your script.")]
public class Note : Command
public class Comment : Command
{
[TextArea(2,4)]
public string commentText = "";

2
Assets/Fungus/Dialog/Commands/SetChooseDialog.cs.meta → Assets/Fungus/FungusScript/Commands/Comment.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 926adf8389384479eb93ef4d6ce8eb33
guid: ea6e8f632db87477eb750446b28d73a3
MonoImporter:
serializedVersion: 2
defaultReferences: []

8
Assets/Fungus/FungusScript/Commands/Note.cs.meta

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 69d14ccff3ce441ecba28c9a53b98a08
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

8
Assets/Fungus/FungusScript/Editor/CommandEditor.cs

@ -103,6 +103,13 @@ namespace Fungus
}
GUILayout.EndVertical();
// Display help text
CommandInfoAttribute infoAttr = CommandEditor.GetCommandInfo(t.GetType());
if (infoAttr != null)
{
EditorGUILayout.HelpBox(infoAttr.CommandName + ":\n" + infoAttr.HelpText, MessageType.Info, true);
}
}
public virtual void DrawCommandGUI()
@ -127,6 +134,7 @@ namespace Fungus
EditorGUILayout.PropertyField(iterator, true, new GUILayoutOption[0]);
}
serializedObject.ApplyModifiedProperties();
}

189
Assets/Fungus/FungusScript/Editor/CommandListAdaptor.cs

@ -13,17 +13,12 @@ namespace Fungus
{
public class CommandListAdaptor : IReorderableListAdaptor {
protected class SetCommandOperation
{
public Sequence sequence;
public Type commandType;
public int index;
}
protected SerializedProperty _arrayProperty;
public float fixedItemHeight;
public Rect nodeRect = new Rect();
public SerializedProperty this[int index] {
get { return _arrayProperty.GetArrayElementAtIndex(index); }
}
@ -94,8 +89,9 @@ namespace Fungus
return null;
}
Command newCommand = Undo.AddComponent<Note>(sequence.gameObject) as Command;
fungusScript.selectedCommand = newCommand;
Command newCommand = Undo.AddComponent<Comment>(sequence.gameObject) as Command;
fungusScript.selectedCommands.Clear();
fungusScript.selectedCommands.Add(newCommand);
return newCommand;
}
@ -122,7 +118,10 @@ namespace Fungus
public void Remove(int index) {
// Remove the Fungus Command component
Command command = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Command;
Undo.DestroyObjectImmediate(command);
if (command != null)
{
Undo.DestroyObjectImmediate(command);
}
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null;
_arrayProperty.DeleteArrayElementAtIndex(index);
@ -162,7 +161,7 @@ namespace Fungus
return;
}
bool isNote = command.GetType() == typeof(Note);
bool isComment = command.GetType() == typeof(Comment);
bool error = false;
string summary = command.GetSummary().Replace("\n", "").Replace("\r", "");
@ -176,44 +175,66 @@ namespace Fungus
}
summary = "<i>" + summary + "</i>";
bool commandIsSelected = false;
foreach (Command selectedCommand in fungusScript.selectedCommands)
{
if (selectedCommand == command)
{
commandIsSelected = true;
break;
}
}
bool highlight = (Application.isPlaying && command.IsExecuting()) ||
(!Application.isPlaying && fungusScript.selectedCommand == command);
(!Application.isPlaying && commandIsSelected);
string commandName = commandInfoAttr.CommandName;
GUIStyle commandLabelStyle = new GUIStyle(GUI.skin.box);
commandLabelStyle.normal.background = FungusEditorResources.texCommandBackground;
commandLabelStyle.border.top = 1;
commandLabelStyle.border.bottom = 1;
commandLabelStyle.border.left = 1;
commandLabelStyle.border.right = 1;
commandLabelStyle.alignment = TextAnchor.MiddleLeft;
commandLabelStyle.richText = true;
commandLabelStyle.fontSize = 11;
commandLabelStyle.padding.top -= 1;
float indentSize = 20;
for (int i = 0; i < command.indentLevel; ++i)
{
Rect indentRect = position;
indentRect.x += i * indentSize;
indentRect.x += i * indentSize - 21;
indentRect.width = indentSize + 1;
indentRect.y -= 2;
indentRect.height += 5;
GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f, 0.5f);
GUI.Box(indentRect, "");
GUI.backgroundColor = new Color(0.5f, 0.5f, 0.5f, 1f);
GUI.Box(indentRect, "", commandLabelStyle);
}
string commandName = commandInfoAttr.CommandName;
GUIStyle commandLabelStyle = new GUIStyle(EditorStyles.miniButton);
commandLabelStyle.alignment = TextAnchor.MiddleLeft;
commandLabelStyle.richText = true;
commandLabelStyle.fontSize = 11;
commandLabelStyle.padding.top -= 1;
float commandNameWidth = Mathf.Max(commandLabelStyle.CalcSize(new GUIContent(commandName)).x, 90f);
float indentWidth = command.indentLevel * indentSize;
Rect commandLabelRect = position;
commandLabelRect.x += indentWidth;
commandLabelRect.x += indentWidth - 21;
commandLabelRect.y -= 2;
commandLabelRect.width -= (indentSize * command.indentLevel + 24);
commandLabelRect.height += 6;
commandLabelRect.width -= (indentSize * command.indentLevel - 22);
commandLabelRect.height += 5;
if (!Application.isPlaying &&
Event.current.type == EventType.MouseDown &&
Event.current.button == 0 &&
(Event.current.button == 0 || Event.current.button == 1) &&
position.Contains(Event.current.mousePosition))
{
fungusScript.selectedCommand = command;
if (fungusScript.selectedCommands.Contains(command) && Event.current.button == 0)
{
fungusScript.selectedCommands.Remove(command);
}
else
{
fungusScript.selectedCommands.Add(command);
}
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
}
@ -236,17 +257,23 @@ namespace Fungus
// TODO: Show warning icon
}
if (!isNote)
GUI.backgroundColor = commandLabelColor;
if (isComment)
{
GUI.Label(commandLabelRect, "", commandLabelStyle);
}
else
{
GUI.backgroundColor = commandLabelColor;
GUI.Label(commandLabelRect, commandName, commandLabelStyle);
}
Rect summaryRect = new Rect(commandLabelRect);
if (!isNote)
if (!isComment)
{
summaryRect.x += commandNameWidth;
summaryRect.width -= commandNameWidth;
summaryRect.width -= 5;
}
if (error)
@ -260,31 +287,15 @@ namespace Fungus
summaryRect.width -= 20;
}
GUIStyle summaryStyle = new GUIStyle(EditorStyles.miniLabel);
summaryStyle.padding.top += 3;
GUIStyle summaryStyle = new GUIStyle();
summaryStyle.fontSize = 10;
summaryStyle.padding.top += 5;
summaryStyle.richText = true;
summaryStyle.wordWrap = false;
summaryStyle.clipping = TextClipping.Clip;
GUI.Label(summaryRect, summary, summaryStyle);
GUI.backgroundColor = Color.white;
if (!Application.isPlaying)
{
Rect menuRect = commandLabelRect;
menuRect.x += menuRect.width + 4;
menuRect.y = position.y + 1;
menuRect.width = 22;
menuRect.height = position.height;
GUIStyle menuButtonStyle = new GUIStyle("Foldout");
if (GUI.Button(menuRect, new GUIContent("", "Select command type"), menuButtonStyle))
{
ShowCommandMenu(index, fungusScript.selectedSequence);
}
Rect selectRect = position;
selectRect.x -= 19;
selectRect.width = 20;
command.selected = EditorGUI.Toggle(selectRect, command.selected);
}
}
public virtual float GetItemHeight(int index) {
@ -330,80 +341,6 @@ namespace Fungus
break;
}
}
void ShowCommandMenu(int index, Sequence sequence)
{
GenericMenu commandMenu = new GenericMenu();
// Build menu list
List<System.Type> menuTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList();
List<KeyValuePair<System.Type, CommandInfoAttribute>> filteredAttributes = GetFilteredCommandInfoAttribute(menuTypes);
foreach(var keyPair in filteredAttributes)
{
SetCommandOperation commandOperation = new SetCommandOperation();
commandOperation.sequence = sequence;
commandOperation.commandType = keyPair.Key;
commandOperation.index = index;
commandMenu.AddItem (new GUIContent (keyPair.Value.Category + "/" + keyPair.Value.CommandName),
false, Callback, commandOperation);
}
commandMenu.ShowAsContext();
}
List<KeyValuePair<System.Type,CommandInfoAttribute>> GetFilteredCommandInfoAttribute(List<System.Type> menuTypes)
{
Dictionary<string, KeyValuePair<System.Type, CommandInfoAttribute>> filteredAttributes = new Dictionary<string, KeyValuePair<System.Type, CommandInfoAttribute>>();
foreach (System.Type type in menuTypes)
{
object[] attributes = type.GetCustomAttributes(false);
foreach (object obj in attributes)
{
CommandInfoAttribute infoAttr = obj as CommandInfoAttribute;
if (infoAttr != null)
{
string dictionaryName = string.Format("{0}/{1}", infoAttr.Category, infoAttr.CommandName);
int existingItemPriority = -1;
if (filteredAttributes.ContainsKey(dictionaryName))
{
existingItemPriority = filteredAttributes[dictionaryName].Value.Priority;
}
if (infoAttr.Priority > existingItemPriority)
{
KeyValuePair<System.Type, CommandInfoAttribute> keyValuePair = new KeyValuePair<System.Type, CommandInfoAttribute>(type, infoAttr);
filteredAttributes[dictionaryName] = keyValuePair;
}
}
}
}
return filteredAttributes.Values.ToList<KeyValuePair<System.Type,CommandInfoAttribute>>();
}
void Callback(object obj)
{
SetCommandOperation commandOperation = obj as SetCommandOperation;
Sequence sequence = commandOperation.sequence;
if (sequence == null)
{
return;
}
Command newCommand = Undo.AddComponent(sequence.gameObject, commandOperation.commandType) as Command;
sequence.GetFungusScript().selectedCommand = newCommand;
Command oldCommand = sequence.commandList[commandOperation.index];
Undo.DestroyObjectImmediate(oldCommand);
Undo.RecordObject(sequence, "Set command type");
sequence.commandList[commandOperation.index] = newCommand;
}
}
}

79
Assets/Fungus/FungusScript/Editor/EditorZoomArea.cs

@ -0,0 +1,79 @@
// Original code by Martin Ecker (http://martinecker.com)
using UnityEngine;
// Helper Rect extension methods
public static class RectExtensions
{
public static Vector2 TopLeft(this Rect rect)
{
return new Vector2(rect.xMin, rect.yMin);
}
public static Rect ScaleSizeBy(this Rect rect, float scale)
{
return rect.ScaleSizeBy(scale, rect.center);
}
public static Rect ScaleSizeBy(this Rect rect, float scale, Vector2 pivotPoint)
{
Rect result = rect;
result.x -= pivotPoint.x;
result.y -= pivotPoint.y;
result.xMin *= scale;
result.xMax *= scale;
result.yMin *= scale;
result.yMax *= scale;
result.x += pivotPoint.x;
result.y += pivotPoint.y;
return result;
}
public static Rect ScaleSizeBy(this Rect rect, Vector2 scale)
{
return rect.ScaleSizeBy(scale, rect.center);
}
public static Rect ScaleSizeBy(this Rect rect, Vector2 scale, Vector2 pivotPoint)
{
Rect result = rect;
result.x -= pivotPoint.x;
result.y -= pivotPoint.y;
result.xMin *= scale.x;
result.xMax *= scale.x;
result.yMin *= scale.y;
result.yMax *= scale.y;
result.x += pivotPoint.x;
result.y += pivotPoint.y;
return result;
}
}
public class EditorZoomArea
{
private const float kEditorWindowTabHeight = 21.0f;
private static Matrix4x4 _prevGuiMatrix;
public static Rect Begin(float zoomScale, Rect screenCoordsArea)
{
GUI.EndGroup(); // End the group Unity begins automatically for an EditorWindow to clip out the window tab. This allows us to draw outside of the size of the EditorWindow.
Rect clippedArea = screenCoordsArea.ScaleSizeBy(1.0f / zoomScale, screenCoordsArea.TopLeft());
clippedArea.y += kEditorWindowTabHeight;
GUI.BeginGroup(clippedArea);
_prevGuiMatrix = GUI.matrix;
Matrix4x4 translation = Matrix4x4.TRS(clippedArea.TopLeft(), Quaternion.identity, Vector3.one);
Matrix4x4 scale = Matrix4x4.Scale(new Vector3(zoomScale, zoomScale, 1.0f));
GUI.matrix = translation * scale * translation.inverse * GUI.matrix;
return clippedArea;
}
public static void End()
{
GUI.matrix = _prevGuiMatrix;
GUI.EndGroup();
GUI.BeginGroup(new Rect(0.0f, kEditorWindowTabHeight, Screen.width, Screen.height));
}
}

2
Assets/Fungus/Dialog/Commands/SetSayDialog.cs.meta → Assets/Fungus/FungusScript/Editor/EditorZoomArea.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 60846452b4dd44937b12b1c00111d8fc
guid: 21069ce91309a44daa0798b2d7c3635b
MonoImporter:
serializedVersion: 2
defaultReferences: []

122
Assets/Fungus/FungusScript/Editor/FungusEditorResources.cs

@ -0,0 +1,122 @@
using UnityEngine;
using UnityEditor;
using System;
namespace Fungus
{
internal static class FungusEditorResources
{
static FungusEditorResources() {
GenerateSpecialTextures();
LoadResourceAssets();
}
private enum ResourceName
{
add_button = 0,
add_button_active,
title_background,
command_background
}
private static string[] s_LightSkin = {
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEA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ftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAC1JREFUeNpiXLlyJQM2wMLAwBAWFoYmumrVKiYGHIAeEiwQN2BKAAAAAP//AwCS4wcNfhpDgQAAAABJRU5ErkJggg=="
};
public static Texture2D texAddButton
{
get { return s_Cached[(int)ResourceName.add_button]; }
}
public static Texture2D texAddButtonActive
{
get { return s_Cached[(int)ResourceName.add_button_active]; }
}
public static Texture2D texTitleBackground
{
get { return s_Cached[(int)ResourceName.title_background]; }
}
public static Texture2D texCommandBackground
{
get { return s_Cached[(int)ResourceName.command_background]; }
}
public static Texture2D texItemSplitter { get; private set; }
private static void GenerateSpecialTextures()
{
var splitterColor = EditorGUIUtility.isProSkin
? new Color(1f, 1f, 1f, 0.14f)
: new Color(0.59f, 0.59f, 0.59f, 0.55f)
;
texItemSplitter = CreatePixelTexture("(Generated) Item Splitter", splitterColor);
}
public static Texture2D CreatePixelTexture(string name, Color color)
{
var tex = new Texture2D(1, 1, TextureFormat.ARGB32, false, true);
tex.name = name;
tex.hideFlags = HideFlags.HideAndDontSave;
tex.filterMode = FilterMode.Point;
tex.SetPixel(0, 0, color);
tex.Apply();
return tex;
}
private static Texture2D[] s_Cached;
public static void LoadResourceAssets()
{
var skin = EditorGUIUtility.isProSkin ? s_DarkSkin : s_LightSkin;
s_Cached = new Texture2D[skin.Length];
for (int i = 0; i < s_Cached.Length; ++i) {
// Get image data (PNG) from base64 encoded strings.
byte[] imageData = Convert.FromBase64String(skin[i]);
// Gather image size from image data.
int texWidth, texHeight;
GetImageSize(imageData, out texWidth, out texHeight);
// Generate texture asset.
var tex = new Texture2D(texWidth, texHeight, TextureFormat.ARGB32, false, true);
tex.hideFlags = HideFlags.HideAndDontSave;
tex.name = "(Generated) ReorderableList:" + i;
tex.filterMode = FilterMode.Point;
tex.LoadImage(imageData);
s_Cached[i] = tex;
}
s_LightSkin = null;
s_DarkSkin = null;
}
private static void GetImageSize(byte[] imageData, out int width, out int height)
{
width = ReadInt(imageData, 3 + 15);
height = ReadInt(imageData, 3 + 15 + 2 + 2);
}
private static int ReadInt(byte[] imageData, int offset)
{
return (imageData[offset] << 8) | imageData[offset + 1];
}
}
}

2
Assets/Fungus/Dialog/Editor/SetChooseDialogEditor.cs.meta → Assets/Fungus/FungusScript/Editor/FungusEditorResources.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 30d7485e3cb3a4fb0b0440b39c3e0f69
guid: d2af387304e4b454b9ce8b815799cad0
MonoImporter:
serializedVersion: 2
defaultReferences: []

28
Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs

@ -35,11 +35,13 @@ namespace Fungus
{
if (fungusScript.executingSequence == null)
{
fungusScript.selectedCommand = null;
fungusScript.selectedCommands.Clear();
}
else
{
fungusScript.selectedCommand = fungusScript.executingSequence.activeCommand;
fungusScript.selectedCommands.Clear();
fungusScript.selectedCommands.Add(fungusScript.executingSequence.activeCommand);
EditorUtility.SetDirty(fungusScript);
}
}
@ -72,11 +74,25 @@ namespace Fungus
EditorGUILayout.Separator();
if (fungusScript.selectedCommand != null)
if (fungusScript.selectedSequence != null)
{
CommandEditor commandEditor = Editor.CreateEditor(fungusScript.selectedCommand) as CommandEditor;
commandEditor.DrawCommandInspectorGUI();
DestroyImmediate(commandEditor);
SequenceEditor sequenceEditor = Editor.CreateEditor(fungusScript.selectedSequence) as SequenceEditor;
sequenceEditor.DrawInspectorGUI(fungusScript);
DestroyImmediate(sequenceEditor);
}
if (fungusScript.selectedCommands.Count == 1)
{
if (fungusScript.selectedCommands[0] == null)
{
fungusScript.selectedCommands.Clear();
}
else
{
CommandEditor commandEditor = Editor.CreateEditor(fungusScript.selectedCommands[0]) as CommandEditor;
commandEditor.DrawCommandInspectorGUI();
DestroyImmediate(commandEditor);
}
}
EditorGUILayout.Separator();

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

@ -14,8 +14,12 @@ namespace Fungus
newFungusScriptGO.name = "FungusScript";
FungusScript fungusScript = newFungusScriptGO.AddComponent<FungusScript>();
Sequence sequence = Undo.AddComponent<Sequence>(newFungusScriptGO);
sequence.nodeRect.x += 50;
sequence.nodeRect.y += 50;
sequence.nodeRect.width = 240;
fungusScript.startSequence = sequence;
fungusScript.selectedSequence = sequence;
fungusScript.scrollPos = Vector2.zero;
Undo.RegisterCreatedObjectUndo(newFungusScriptGO, "Create Fungus Script");
}
}

677
Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

@ -8,18 +8,28 @@ namespace Fungus
{
public class FungusScriptWindow : EditorWindow
{
protected bool resize = false;
protected Rect cursorChangeRect;
protected const float minViewWidth = 350;
protected Vector2 newNodePosition = new Vector2();
static bool locked = false;
static GUIStyle lockButtonStyle;
static FungusScript activeFungusScript;
public static List<Sequence> deleteList = new List<Sequence>();
protected List<Sequence> windowSequenceMap = new List<Sequence>();
[MenuItem("Window/Fungus Script")]
// The ReorderableList control doesn't drag properly when used with GUI.DragWindow(),
// so we just implement dragging ourselves.
protected bool dragging;
protected Vector2 startDragPosition;
protected Sequence selectedSequence;
protected const float minZoomValue = 0.5f;
protected const float maxZoomValue = 1f;
// Set this flag to tell the context menu to appear.
// The context menu is modal, so we need to defer displaying it if the background needs to be repainted
public static bool showContextMenu;
[MenuItem("Window/Fungus Script")]
static void Init()
{
GetWindow(typeof(FungusScriptWindow), false, "Fungus Script");
@ -67,78 +77,100 @@ namespace Fungus
return;
}
GUILayout.BeginHorizontal();
// Delete any scheduled objects
foreach (Sequence deleteSequence in deleteList)
{
foreach (Command command in deleteSequence.commandList)
{
Undo.DestroyObjectImmediate(command);
}
Undo.DestroyObjectImmediate(deleteSequence);
fungusScript.selectedSequence = null;
fungusScript.selectedCommands.Clear();
}
deleteList.Clear();
DrawScriptView(fungusScript);
ResizeViews(fungusScript);
DrawSequenceView(fungusScript);
GUILayout.EndHorizontal();
DrawControls(fungusScript);
if (Event.current.type == EventType.Repaint &&
showContextMenu)
{
ShowContextMenu();
showContextMenu = false;
}
}
protected virtual void DrawScriptView(FungusScript fungusScript)
protected virtual void DrawControls(FungusScript fungusScript)
{
EditorUtility.SetDirty(fungusScript);
GUILayout.Space(8);
Sequence[] sequences = fungusScript.GetComponentsInChildren<Sequence>(true);
GUILayout.BeginHorizontal();
Rect scrollViewRect = new Rect();
GUILayout.Space(8);
foreach (Sequence s in sequences)
if (GUILayout.Button(FungusEditorResources.texAddButton))
{
scrollViewRect.xMin = Mathf.Min(scrollViewRect.xMin, s.nodeRect.xMin);
scrollViewRect.xMax = Mathf.Max(scrollViewRect.xMax, s.nodeRect.xMax);
scrollViewRect.yMin = Mathf.Min(scrollViewRect.yMin, s.nodeRect.yMin);
scrollViewRect.yMax = Mathf.Max(scrollViewRect.yMax, s.nodeRect.yMax);
Vector2 newNodePosition = new Vector2(50 - fungusScript.scrollPos.x,
50 - fungusScript.scrollPos.y);
CreateSequence(fungusScript, newNodePosition);
}
// Empty buffer area around edges of scroll rect
float bufferScale = 0.25f;
scrollViewRect.xMin -= position.width * bufferScale;
scrollViewRect.yMin -= position.height * bufferScale;
scrollViewRect.xMax += position.width * bufferScale;
scrollViewRect.yMax += position.height * bufferScale;
// Calc rect for left hand script view
Rect scriptViewRect = new Rect(0, 0, this.position.width - fungusScript.commandViewWidth, this.position.height);
GUILayout.FlexibleSpace();
// Clip GL drawing so not to overlap scrollbars
Rect clipRect = new Rect(fungusScript.scriptScrollPos.x + scrollViewRect.x,
fungusScript.scriptScrollPos.y + scrollViewRect.y,
scriptViewRect.width - 15,
scriptViewRect.height - 15);
fungusScript.zoom = GUILayout.HorizontalSlider(fungusScript.zoom, minZoomValue, maxZoomValue, GUILayout.Width(100));
GUILayoutUtility.GetRect(scriptViewRect.width, scriptViewRect.height);
GUILayout.EndHorizontal();
}
fungusScript.scriptScrollPos = GLDraw.BeginScrollView(scriptViewRect, fungusScript.scriptScrollPos, scrollViewRect, clipRect);
protected virtual void DrawScriptView(FungusScript fungusScript)
{
Sequence[] sequences = fungusScript.GetComponentsInChildren<Sequence>(true);
if (Event.current.type == EventType.ContextClick &&
clipRect.Contains(Event.current.mousePosition))
foreach (Sequence s in sequences)
{
GenericMenu menu = new GenericMenu();
Vector2 mousePos = Event.current.mousePosition;
mousePos += fungusScript.scriptScrollPos;
menu.AddItem (new GUIContent ("Create Sequence"), false, CreateSequenceCallback, mousePos);
menu.ShowAsContext ();
Event.current.Use();
fungusScript.scrollViewRect.xMin = Mathf.Min(fungusScript.scrollViewRect.xMin, s.nodeRect.xMin - 400);
fungusScript.scrollViewRect.xMax = Mathf.Max(fungusScript.scrollViewRect.xMax, s.nodeRect.xMax + 400);
fungusScript.scrollViewRect.yMin = Mathf.Min(fungusScript.scrollViewRect.yMin, s.nodeRect.yMin - 400);
fungusScript.scrollViewRect.yMax = Mathf.Max(fungusScript.scrollViewRect.yMax, s.nodeRect.yMax + 400);
}
// Calculate center of script view for positioning new nodes
newNodePosition.x = scrollViewRect.xMin + fungusScript.scriptScrollPos.x + scriptViewRect.width / 2;
newNodePosition.y = scrollViewRect.yMin + fungusScript.scriptScrollPos.y + scriptViewRect.height / 2;
// Calc rect for script view
Rect scriptViewRect = new Rect(0, 0, this.position.width / fungusScript.zoom, this.position.height / fungusScript.zoom);
BeginWindows();
EditorZoomArea.Begin(fungusScript.zoom, scriptViewRect);
GUIStyle windowStyle = new GUIStyle(EditorStyles.toolbarButton);
windowStyle.stretchHeight = true;
windowStyle.fixedHeight = 20;
DrawGrid(fungusScript);
GLDraw.BeginGroup(scriptViewRect);
if (Event.current.button == 0 &&
Event.current.type == EventType.MouseDown)
{
selectedSequence = fungusScript.selectedSequence;
fungusScript.selectedSequence = null;
fungusScript.selectedCommand = null;
if (!EditorGUI.actionKey)
{
fungusScript.ClearSelectedCommands();
}
}
// Draw connections
foreach (Sequence s in sequences)
{
DrawConnections(fungusScript, s, false);
}
foreach (Sequence s in sequences)
{
DrawConnections(fungusScript, s, true);
}
GUIStyle windowStyle = new GUIStyle();
windowStyle.stretchHeight = true;
BeginWindows();
windowSequenceMap.Clear();
for (int i = 0; i < sequences.Length; ++i)
{
@ -147,37 +179,75 @@ namespace Fungus
// Hack to support legacy design where sequences were child gameobjects (will be removed soon)
sequence.UpdateSequenceName();
float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x;
float windowWidth = Mathf.Max (titleWidth + 10, 100);
sequence.nodeRect.height = CalcRectHeight(sequence.commandList.Count);
if (fungusScript.selectedSequence == sequence ||
fungusScript.executingSequence == sequence)
{
GUI.backgroundColor = Color.green;
}
Rect windowRect = new Rect(sequence.nodeRect);
windowRect.x += fungusScript.scrollPos.x;
windowRect.y += fungusScript.scrollPos.y;
windowRect.width = 240;
sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, "", windowStyle, GUILayout.Width(windowWidth), GUILayout.Height(20), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
GUILayout.Window(i, windowRect, DrawWindow, "", windowStyle);
GUI.backgroundColor = Color.white;
windowSequenceMap.Add(sequence);
}
// Draw connections
foreach (Sequence s in windowSequenceMap)
EndWindows();
// Right click to drag view
if (Event.current.button == 1 && Event.current.type == EventType.MouseDrag)
{
DrawConnections(fungusScript, s, false);
fungusScript.scrollPos += Event.current.delta;
}
foreach (Sequence s in windowSequenceMap)
else if (Event.current.type == EventType.ScrollWheel)
{
DrawConnections(fungusScript, s, true);
fungusScript.zoom -= Event.current.delta.y * 0.01f;
fungusScript.zoom = Mathf.Clamp(fungusScript.zoom, minZoomValue, maxZoomValue);
}
EndWindows();
GLDraw.EndGroup();
EditorZoomArea.End();
}
protected virtual void DrawGrid(FungusScript fungusScript)
{
float width = this.position.width / fungusScript.zoom;
float height = this.position.height / fungusScript.zoom;
// Match background color of scene view
if (EditorGUIUtility.isProSkin)
{
GUI.color = new Color32(71, 71, 71, 255);
}
else
{
GUI.color = new Color32(86, 86, 86, 255);
}
GUI.DrawTexture( new Rect(0,0, width, height), EditorGUIUtility.whiteTexture );
GLDraw.EndScrollView();
GUI.color = Color.white;
Color color = new Color32(96, 96, 96, 255);
float gridSize = 128f;
float x = fungusScript.scrollPos.x % gridSize;
while (x < width)
{
GLDraw.DrawLine(new Vector2(x, 0), new Vector2(x, height), color, 1f);
x += gridSize;
}
float y = fungusScript.scrollPos.y % gridSize;
while (y < height)
{
GLDraw.DrawLine(new Vector2(0, y), new Vector2(width, y), color, 1f);
y += gridSize;
}
}
/*
protected virtual void ResizeViews(FungusScript fungusScript)
{
cursorChangeRect = new Rect(this.position.width - fungusScript.commandViewWidth, 0, 4f, this.position.height);
@ -270,13 +340,15 @@ namespace Fungus
GUILayout.EndScrollView();
}
*/
protected virtual Sequence CreateSequence(FungusScript fungusScript, Vector2 position)
public static Sequence CreateSequence(FungusScript fungusScript, Vector2 position)
{
Sequence newSequence = fungusScript.CreateSequence(position);
Undo.RegisterCreatedObjectUndo(newSequence, "New Sequence");
fungusScript.selectedSequence = newSequence;
fungusScript.selectedCommand = null;
fungusScript.ClearSelectedCommands();
newSequence.nodeRect.width = 240;
return newSequence;
}
@ -290,81 +362,104 @@ namespace Fungus
Undo.DestroyObjectImmediate(sequence);
fungusScript.selectedSequence = null;
fungusScript.selectedCommand = null;
fungusScript.ClearSelectedCommands();
}
protected virtual void DuplicateSequence(FungusScript fungusScript, Sequence sequence)
protected virtual void DrawWindow(int windowId)
{
if (sequence == null)
{
return;
}
Vector2 newPosition = new Vector2(sequence.nodeRect.position.x + sequence.nodeRect.width + 20, sequence.nodeRect.y);
Sequence newSequence = CreateSequence(fungusScript, newPosition);
newSequence.sequenceName = sequence.sequenceName + " (Copy)";
Sequence sequence = windowSequenceMap[windowId];
FungusScript fungusScript = sequence.GetFungusScript();
foreach (Command command in sequence.commandList)
if (!Application.isPlaying &&
Event.current.button == 0)
{
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(fungusScript.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
if (Event.current.type == EventType.MouseDrag && dragging)
{
field.SetValue(newCommand, field.GetValue(command));
sequence.nodeRect.x += Event.current.delta.x;
sequence.nodeRect.y += Event.current.delta.y;
}
newCommand.selected = false;
newSequence.commandList.Add(newCommand);
}
}
else if (Event.current.type == EventType.MouseUp &&
dragging)
{
Vector2 newPos = new Vector2(sequence.nodeRect.x, sequence.nodeRect.y);
protected virtual void CreateSequenceCallback(object item)
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript != null)
{
Vector2 position = (Vector2)item;
position -= fungusScript.scriptScrollPos;
CreateSequence(fungusScript, position);
sequence.nodeRect.x = startDragPosition.x;
sequence.nodeRect.y = startDragPosition.y;
Undo.RecordObject(sequence, "Node Position");
sequence.nodeRect.x = newPos.x;
sequence.nodeRect.y = newPos.y;
dragging = false;
}
}
}
protected virtual void DrawWindow(int windowId)
{
// Select sequence when node is clicked
if (!Application.isPlaying &&
Event.current.button == 0 &&
Event.current.type == EventType.MouseDown)
(Event.current.button == 0 || Event.current.button == 1) &&
(Event.current.type == EventType.MouseDown))
{
// Check if might be start of a window drag
if (Event.current.button == 0 &&
Event.current.mousePosition.y < 26)
{
dragging = true;
startDragPosition.x = sequence.nodeRect.x;
startDragPosition.y = sequence.nodeRect.y;
}
if (windowId < windowSequenceMap.Count)
{
Sequence s = windowSequenceMap[windowId];
if (s != null)
Undo.RecordObject(fungusScript, "Select");
if (sequence != selectedSequence || !EditorGUI.actionKey)
{
FungusScript fungusScript = s.GetFungusScript();
if (fungusScript != null)
int commandIndex = CalcCommandIndex(Event.current.mousePosition.y);
if (commandIndex < sequence.commandList.Count &&
fungusScript.selectedCommands.Contains(sequence.commandList[commandIndex]))
{
fungusScript.selectedSequence = s;
fungusScript.selectedCommand = null;
Selection.activeGameObject = fungusScript.gameObject;
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
// Right clicking on an already selected command does not clear the selected list
}
else
{
fungusScript.ClearSelectedCommands();
}
}
if (selectedSequence != sequence &&
Event.current.mousePosition.x > sequence.nodeRect.width - 30f)
{
Event.current.Use();
}
fungusScript.selectedSequence = sequence;
GUIUtility.keyboardControl = 0; // Fix for textarea not refeshing (change focus)
}
}
Sequence sequence = windowSequenceMap[windowId];
GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
labelStyle.alignment = TextAnchor.MiddleCenter;
if (fungusScript.selectedSequence == sequence ||
fungusScript.executingSequence == sequence)
{
GUI.backgroundColor = Color.green;
Rect highlightRect = new Rect(0, 0, sequence.nodeRect.width, 24);
GUIStyle highlightStyle = new GUIStyle();
highlightStyle.normal.background = FungusEditorResources.texCommandBackground;
highlightStyle.border.top = 1;
highlightStyle.border.bottom = 1;
highlightStyle.border.left = 1;
highlightStyle.border.right = 1;
GUI.Box(highlightRect, "", highlightStyle);
GUI.backgroundColor = Color.white;
}
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
GUILayout.Label(sequence.sequenceName, labelStyle);
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
GUI.DragWindow();
SequenceEditor sequenceEditor = Editor.CreateEditor(sequence) as SequenceEditor;
sequenceEditor.DrawCommandListGUI(sequence.GetFungusScript());
DestroyImmediate(sequenceEditor);
GUILayout.EndVertical();
}
protected virtual void DrawConnections(FungusScript fungusScript, Sequence sequence, bool highlightedOnly)
@ -380,7 +475,20 @@ namespace Fungus
foreach (Command command in sequence.commandList)
{
bool commandIsSelected = (fungusScript.selectedCommand == command);
if (command == null)
{
continue;
}
bool commandIsSelected = false;
foreach (Command selectedCommand in fungusScript.selectedCommands)
{
if (selectedCommand == command)
{
commandIsSelected = true;
break;
}
}
bool highlight = command.IsExecuting() || (sequenceIsSelected && commandIsSelected);
@ -401,25 +509,53 @@ namespace Fungus
continue;
}
DrawRectConnection(sequence.nodeRect, sequenceB.nodeRect, highlight);
Rect startRect = new Rect(sequence.nodeRect);
startRect.y += CalcRectHeight(sequence.commandList.Count);
startRect.height = 0;
startRect.x += fungusScript.scrollPos.x;
startRect.y += fungusScript.scrollPos.y;
Rect endRect = new Rect(sequenceB.nodeRect);
endRect.height = 22;
endRect.x += fungusScript.scrollPos.x;
endRect.y += fungusScript.scrollPos.y;
DrawRectConnection(startRect, endRect, highlight);
}
}
}
protected virtual void DrawRectConnection(Rect rectA, Rect rectB, bool highlight)
{
Vector2 pointA;
Vector2 pointB;
Vector2 p1 = rectA.center;
Vector2 p2 = rectB.center;
GLDraw.segment_rect_intersection(rectA, ref p1, ref p2);
pointA = p2;
p1 = rectB.center;
p2 = rectA.center;
GLDraw.segment_rect_intersection(rectB, ref p1, ref p2);
pointB = p2;
Vector2[] pointsA = new Vector2[] {
new Vector2(rectA.xMin, rectA.center.y),
new Vector2(rectA.xMin + rectA.width / 2, rectA.yMax + 15),
new Vector2(rectA.xMax, rectA.center.y)
};
Vector2[] pointsB = new Vector2[] {
new Vector2(rectB.xMin, rectB.center.y + 4),
new Vector2(rectB.xMin + rectB.width / 2, rectB.yMin),
new Vector2(rectB.xMax, rectB.center.y + 4)
};
Vector2 pointA = Vector2.zero;
Vector2 pointB = Vector2.zero;
float minDist = float.MaxValue;
foreach (Vector2 a in pointsA)
{
foreach (Vector2 b in pointsB)
{
float d = Vector2.Distance(a, b);
if (d < minDist)
{
pointA = a;
pointB = b;
minDist = d;
}
}
}
Color color = Color.grey;
if (highlight)
@ -427,8 +563,279 @@ namespace Fungus
color = Color.green;
}
GLDraw.DrawConnectingCurve(pointA, pointB, color, 2f);
GLDraw.DrawConnectingCurve(pointA, pointB, color, 1.025f);
Rect dotARect = new Rect(pointA.x - 5, pointA.y - 5, 10, 10);
GUI.Label(dotARect, "", new GUIStyle("U2D.dragDotActive"));
Rect dotBRect = new Rect(pointB.x - 5, pointB.y - 5, 10, 10);
GUI.Label(dotBRect, "", new GUIStyle("U2D.dragDotActive"));
}
}
protected virtual float CalcRectHeight(int numCommands)
{
return (numCommands * 20) + 34;
}
protected virtual int CalcCommandIndex(float mouseY)
{
return Math.Max(0, (int)(mouseY - 34 + 7) / 20);
}
public static void ShowContextMenu()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null)
{
return;
}
bool showCut = false;
bool showCopy = false;
bool showDelete = false;
bool showPaste = false;
if (fungusScript.selectedCommands.Count > 0)
{
showCut = true;
showCopy = true;
showDelete = true;
}
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
if (commandCopyBuffer.HasCommands())
{
showPaste = true;
}
GenericMenu commandMenu = new GenericMenu();
if (showCut)
{
commandMenu.AddItem (new GUIContent ("Cut"), false, Cut);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Cut"));
}
if (showCopy)
{
commandMenu.AddItem (new GUIContent ("Copy"), false, Copy);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Copy"));
}
if (showPaste)
{
commandMenu.AddItem (new GUIContent ("Paste"), false, Paste);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Paste"));
}
if (showDelete)
{
commandMenu.AddItem (new GUIContent ("Delete"), false, Delete);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Delete"));
}
commandMenu.AddSeparator("");
commandMenu.AddItem (new GUIContent ("Select All"), false, SelectAll);
commandMenu.AddItem (new GUIContent ("Select None"), false, SelectNone);
commandMenu.AddSeparator("");
commandMenu.AddItem (new GUIContent ("Delete Sequence"), false, DeleteSequence);
commandMenu.AddItem (new GUIContent ("Duplicate Sequence"), false, DuplicateSequence);
commandMenu.ShowAsContext();
}
protected static void SelectAll()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
fungusScript.ClearSelectedCommands();
Undo.RecordObject(fungusScript, "Select All");
foreach (Command command in fungusScript.selectedSequence.commandList)
{
fungusScript.selectedCommands.Add(command);
}
}
protected static void SelectNone()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
Undo.RecordObject(fungusScript, "Select None");
fungusScript.ClearSelectedCommands();
}
protected static void Cut()
{
Copy();
Delete();
}
protected static void Copy()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
commandCopyBuffer.Clear();
foreach (Command command in fungusScript.selectedCommands)
{
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(commandCopyBuffer.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{
field.SetValue(newCommand, field.GetValue(command));
}
}
}
protected static void Paste()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
// Find where to paste commands in sequence (either at end or after last selected command)
int pasteIndex = fungusScript.selectedSequence.commandList.Count;
if (fungusScript.selectedCommands.Count > 0)
{
for (int i = 0; i < fungusScript.selectedSequence.commandList.Count; ++i)
{
Command command = fungusScript.selectedSequence.commandList[i];
foreach (Command selectedCommand in fungusScript.selectedCommands)
{
if (command == selectedCommand)
{
pasteIndex = i + 1;
}
}
}
}
foreach (Command command in commandCopyBuffer.GetCommands())
{
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(fungusScript.selectedSequence.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{
field.SetValue(newCommand, field.GetValue(command));
}
Undo.RecordObject(fungusScript.selectedSequence, "Paste");
fungusScript.selectedSequence.commandList.Insert(pasteIndex++, newCommand);
}
}
protected static void Delete()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
for (int i = fungusScript.selectedSequence.commandList.Count - 1; i >= 0; --i)
{
Command command = fungusScript.selectedSequence.commandList[i];
foreach (Command selectedCommand in fungusScript.selectedCommands)
{
if (command == selectedCommand)
{
Undo.RecordObject(fungusScript.selectedSequence, "Delete");
fungusScript.selectedSequence.commandList.RemoveAt(i);
Undo.DestroyObjectImmediate(command);
break;
}
}
}
Undo.RecordObject(fungusScript, "Delete");
fungusScript.ClearSelectedCommands();
fungusScript.selectedSequence = null;
}
public static void DeleteSequence()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
FungusScriptWindow.deleteList.Add(fungusScript.selectedSequence);
}
protected static void DuplicateSequence()
{
FungusScript fungusScript = GetFungusScript();
if (fungusScript == null ||
fungusScript.selectedSequence == null)
{
return;
}
Vector2 newPosition = new Vector2(fungusScript.selectedSequence.nodeRect.position.x +
fungusScript.selectedSequence.nodeRect.width + 20,
fungusScript.selectedSequence.nodeRect.y);
Sequence oldSequence = fungusScript.selectedSequence;
Sequence newSequence = FungusScriptWindow.CreateSequence(fungusScript, newPosition);
newSequence.sequenceName = oldSequence.sequenceName + " (Copy)";
foreach (Command command in oldSequence.commandList)
{
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(fungusScript.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{
field.SetValue(newCommand, field.GetValue(command));
}
newSequence.commandList.Add(newCommand);
}
}
}
}

13
Assets/Fungus/FungusScript/Editor/GLDraw.cs

@ -90,7 +90,7 @@ public class GLDraw
{
clippingEnabled = true;
clippingBounds = clipRect;
return GUI.BeginScrollView(position, scrollPos, viewRect);
return GUI.BeginScrollView(position, scrollPos, viewRect, GUIStyle.none, GUIStyle.none);
}
public static void EndScrollView()
@ -247,10 +247,10 @@ public class GLDraw
DrawBezier(start, tangentA, end, tangentB, color, width, segments);
Vector2 pA = CubeBezier(start, tangentA, end, tangentB, 0.7f);
Vector2 pB = CubeBezier(start, tangentA, end, tangentB, 0.8f);
Vector2 pA = CubeBezier(start, tangentA, end, tangentB, 0.6f);
Vector2 pB = CubeBezier(start, tangentA, end, tangentB, 0.7f);
float arrowHeadSize = 10;
float arrowHeadSize = 5;
Vector2 arrowPosA = pB;
Vector2 arrowPosB = arrowPosA;
@ -266,9 +266,8 @@ public class GLDraw
arrowPosC.y += dir.x * arrowHeadSize;
arrowPosC -= dir * arrowHeadSize;
DrawLine(arrowPosA, arrowPosB, color, 1);
DrawLine(arrowPosA, arrowPosC, color, 1);
DrawLine(arrowPosB, arrowPosC, color, 1);
DrawLine(arrowPosA, arrowPosB, color, 1.025f);
DrawLine(arrowPosA, arrowPosC, color, 1.025f);
}
public static void DrawBezier(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width)

323
Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

@ -12,68 +12,129 @@ namespace Fungus
[CustomEditor (typeof(Sequence))]
public class SequenceEditor : Editor
{
protected class AddCommandOperation
{
public Sequence sequence;
public Type commandType;
public int index;
}
protected SerializedProperty sequenceNameProp;
protected SerializedProperty descriptionProp;
public virtual void OnEnable()
{
sequenceNameProp = serializedObject.FindProperty("sequenceName");
descriptionProp = serializedObject.FindProperty("description");
}
public virtual void DrawSequenceGUI(FungusScript fungusScript)
{
if (fungusScript.selectedSequence == null)
/*
// Strip out any null commands from the command list
// This can happen if a command class is removed or renamed
serializedObject.Update();
SerializedProperty commandListProperty = serializedObject.FindProperty("commandList");
for (int i = commandListProperty.arraySize - 1; i >= 0; --i)
{
return;
SerializedProperty commandProperty = commandListProperty.GetArrayElementAtIndex(i);
if (commandProperty.objectReferenceValue == null)
{
commandListProperty.DeleteArrayElementAtIndex(i);
}
}
serializedObject.ApplyModifiedProperties();
*/
}
public virtual void DrawInspectorGUI(FungusScript fungusScript)
{
serializedObject.Update();
Sequence sequence = fungusScript.selectedSequence;
EditorGUILayout.PropertyField(sequenceNameProp);
EditorGUILayout.PropertyField(descriptionProp);
EditorGUILayout.Separator();
serializedObject.ApplyModifiedProperties();
}
public virtual void DrawCommandListGUI(FungusScript fungusScript)
{
serializedObject.Update();
Sequence sequence = target as Sequence;
UpdateIndentLevels(sequence);
ReorderableListGUI.Title("Command Sequence");
sequence.nodeRect.width = 240;
ReorderableListGUI.Title(sequence.sequenceName);
SerializedProperty commandListProperty = serializedObject.FindProperty("commandList");
CommandListAdaptor adaptor = new CommandListAdaptor(commandListProperty, 0);
ReorderableListControl.DrawControlFromState(adaptor, null, ReorderableListFlags.HideRemoveButtons);
adaptor.nodeRect = sequence.nodeRect;
if (!Application.isPlaying)
ReorderableListFlags flags = ReorderableListFlags.HideAddButton | ReorderableListFlags.HideRemoveButtons | ReorderableListFlags.DisableContextMenu;
ReorderableListControl.DrawControlFromState(adaptor, null, flags);
Rect bottomBoxRect = GUILayoutUtility.GetRect(sequence.nodeRect.width, 20);
bottomBoxRect.y -= 7;
bottomBoxRect.x += 5;
bottomBoxRect.width -= 10;
if (sequence.commandList.Count == 0)
{
Rect copyMenuRect = GUILayoutUtility.GetLastRect();
copyMenuRect.y += copyMenuRect.height - 17;
copyMenuRect.width = 24;
copyMenuRect.height = 18;
if (GUI.Button(copyMenuRect, "", new GUIStyle("DropDown")))
{
ShowCopyMenu();
}
bottomBoxRect.y -= 16;
}
EditorGUILayout.BeginHorizontal();
GUIStyle boxStyle = new GUIStyle();
boxStyle.border = new RectOffset(2, 2, 2, 1);
boxStyle.margin = new RectOffset(5, 5, 5, 0);
boxStyle.padding = new RectOffset(5, 5, 0, 0);
boxStyle.alignment = TextAnchor.MiddleLeft;
boxStyle.normal.background = FungusEditorResources.texTitleBackground;
boxStyle.normal.textColor = EditorGUIUtility.isProSkin
? new Color(0.8f, 0.8f, 0.8f)
: new Color(0.2f, 0.2f, 0.2f);
GUI.Box(bottomBoxRect, "", boxStyle);
if (fungusScript.selectedCommand != null)
if (!Application.isPlaying &&
sequence == fungusScript.selectedSequence)
{
CommandInfoAttribute infoAttr = CommandEditor.GetCommandInfo(fungusScript.selectedCommand.GetType());
if (infoAttr != null)
// Show add command button
{
EditorGUILayout.HelpBox(infoAttr.CommandName + ":\n" + infoAttr.HelpText, MessageType.Info, true);
}
}
Rect plusRect = bottomBoxRect;
plusRect.x = plusRect.width - 19;
plusRect.y += 2;
plusRect.width = 16;
plusRect.height = 16;
// Need to expand to fill space or else reorderable list width changes if no command is selected
GUILayout.FlexibleSpace();
if (GUI.Button(plusRect, FungusEditorResources.texAddButton, new GUIStyle()))
{
ShowCommandMenu();
}
}
EditorGUILayout.EndHorizontal();
// Show delete sequence button
{
Rect deleteRect = new Rect();
deleteRect.x = sequence.nodeRect.width - 28;
deleteRect.y = 7;
deleteRect.width = 16;
deleteRect.height = 16;
if (GUI.Button(deleteRect, "", new GUIStyle("WinBtnCloseWin")))
{
FungusScriptWindow.DeleteSequence();
}
}
}
serializedObject.ApplyModifiedProperties();
if (!Application.isPlaying)
{
if (Event.current.button == 1 &&
Event.current.type == EventType.MouseDown)
{
// Set a flag to show the context menu on the new display frame
// This gives the sequence list display a chance to update
FungusScriptWindow.showContextMenu = true;
Event.current.Use();
}
}
}
protected virtual void UpdateIndentLevels(Sequence sequence)
@ -163,188 +224,92 @@ namespace Fungus
return result;
}
protected void ShowCopyMenu()
void ShowCommandMenu()
{
bool showCut = false;
bool showCopy = false;
bool showDelete = false;
bool showPaste = false;
Sequence sequence = target as Sequence;
foreach (Command command in sequence.commandList)
{
if (command.selected)
{
showCut = true;
showCopy = true;
showDelete = true;
}
}
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
if (commandCopyBuffer.HasCommands())
{
showPaste = true;
}
int index = sequence.commandList.Count;
GenericMenu commandMenu = new GenericMenu();
commandMenu.AddItem (new GUIContent ("Select All"), false, SelectAll);
commandMenu.AddItem (new GUIContent ("Select None"), false, SelectNone);
commandMenu.AddSeparator("");
if (showCut)
{
commandMenu.AddItem (new GUIContent ("Cut"), false, Cut);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Cut"));
}
// Build menu list
List<System.Type> menuTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList();
List<KeyValuePair<System.Type, CommandInfoAttribute>> filteredAttributes = GetFilteredCommandInfoAttribute(menuTypes);
if (showCopy)
{
commandMenu.AddItem (new GUIContent ("Copy"), false, Copy);
}
else
foreach(var keyPair in filteredAttributes)
{
commandMenu.AddDisabledItem(new GUIContent ("Copy"));
}
AddCommandOperation commandOperation = new AddCommandOperation();
if (showPaste)
{
commandMenu.AddItem (new GUIContent ("Paste"), false, Paste);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Paste"));
}
commandOperation.sequence = sequence;
commandOperation.commandType = keyPair.Key;
commandOperation.index = index;
if (showDelete)
{
commandMenu.AddItem (new GUIContent ("Delete"), false, Delete);
}
else
{
commandMenu.AddDisabledItem(new GUIContent ("Delete"));
commandMenu.AddItem (new GUIContent (keyPair.Value.Category + "/" + keyPair.Value.CommandName),
false, AddCommandCallback, commandOperation);
}
commandMenu.ShowAsContext();
}
protected virtual void SelectAll()
List<KeyValuePair<System.Type,CommandInfoAttribute>> GetFilteredCommandInfoAttribute(List<System.Type> menuTypes)
{
Sequence sequence = target as Sequence;
foreach (Command command in sequence.commandList)
{
Undo.RecordObject(command, "Select All");
command.selected = true;
}
}
protected virtual void SelectNone()
{
Sequence sequence = target as Sequence;
FungusScript fungusScript = sequence.GetFungusScript();
if (fungusScript != null)
{
Undo.RecordObject(fungusScript, "Select None");
fungusScript.selectedCommand = null;
}
Dictionary<string, KeyValuePair<System.Type, CommandInfoAttribute>> filteredAttributes = new Dictionary<string, KeyValuePair<System.Type, CommandInfoAttribute>>();
foreach (Command command in sequence.commandList)
foreach (System.Type type in menuTypes)
{
Undo.RecordObject(command, "Select None");
command.selected = false;
}
}
protected virtual void Cut()
{
Copy();
Delete();
}
protected virtual void Copy()
{
Sequence sequence = target as Sequence;
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
commandCopyBuffer.Clear();
foreach (Command command in sequence.commandList)
{
if (command.selected)
object[] attributes = type.GetCustomAttributes(false);
foreach (object obj in attributes)
{
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(commandCopyBuffer.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
CommandInfoAttribute infoAttr = obj as CommandInfoAttribute;
if (infoAttr != null)
{
field.SetValue(newCommand, field.GetValue(command));
string dictionaryName = string.Format("{0}/{1}", infoAttr.Category, infoAttr.CommandName);
int existingItemPriority = -1;
if (filteredAttributes.ContainsKey(dictionaryName))
{
existingItemPriority = filteredAttributes[dictionaryName].Value.Priority;
}
if (infoAttr.Priority > existingItemPriority)
{
KeyValuePair<System.Type, CommandInfoAttribute> keyValuePair = new KeyValuePair<System.Type, CommandInfoAttribute>(type, infoAttr);
filteredAttributes[dictionaryName] = keyValuePair;
}
}
newCommand.selected = false;
}
}
return filteredAttributes.Values.ToList<KeyValuePair<System.Type,CommandInfoAttribute>>();
}
protected virtual void Paste()
void AddCommandCallback(object obj)
{
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
AddCommandOperation commandOperation = obj as AddCommandOperation;
Sequence sequence = target as Sequence;
FungusScript fungusScript = sequence.GetFungusScript();
// Find where to paste commands in sequence (either at end or after selected command)
int pasteIndex = sequence.commandList.Count;
if (fungusScript.selectedCommand != null)
Sequence sequence = commandOperation.sequence;
if (sequence == null)
{
for (int i = 0; i < sequence.commandList.Count; ++i)
{
Command command = sequence.commandList[i];
if (fungusScript.selectedCommand == command)
{
pasteIndex = i + 1;
break;
}
}
return;
}
foreach (Command command in commandCopyBuffer.GetCommands())
{
System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(sequence.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{
field.SetValue(newCommand, field.GetValue(command));
}
newCommand.selected = false;
sequence.GetFungusScript().ClearSelectedCommands();
Undo.RecordObject(sequence, "Paste");
sequence.commandList.Insert(pasteIndex++, newCommand);
}
}
Command newCommand = Undo.AddComponent(sequence.gameObject, commandOperation.commandType) as Command;
sequence.GetFungusScript().selectedCommands.Add(newCommand);
protected virtual void Delete()
{
Sequence sequence = target as Sequence;
// Let command know it has just been added to the sequence
newCommand.OnCommandAdded(sequence);
for (int i = sequence.commandList.Count - 1; i >= 0; --i)
Undo.RecordObject(sequence, "Set command type");
if (commandOperation.index < sequence.commandList.Count - 1)
{
Command command = sequence.commandList[i];
if (command != null &&
command.selected)
{
Undo.RecordObject(sequence, "Delete");
sequence.commandList.RemoveAt(i);
Undo.DestroyObjectImmediate(command);
}
sequence.commandList[commandOperation.index] = newCommand;
}
else
{
sequence.commandList.Add(newCommand);
}
}
}
}

17
Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs

@ -148,14 +148,23 @@ namespace Fungus
{
// Is an expanded command referencing this variable?
if (fungusScript.selectedSequence != null &&
fungusScript.selectedCommand != null)
fungusScript.selectedCommands.Count > 0)
{
foreach (Command command in fungusScript.selectedSequence.commandList)
{
if (fungusScript.selectedCommand == command &&
command.HasReference(variable))
foreach (Command selectedCommand in fungusScript.selectedCommands)
{
highlight = true;
if (selectedCommand == command &&
command.HasReference(variable))
{
highlight = true;
break;
}
}
if (highlight)
{
break;
}
}
}

9
Assets/Fungus/FungusScript/Scripts/Command.cs

@ -30,9 +30,6 @@ namespace Fungus
[HideInInspector]
public int indentLevel;
[HideInInspector]
public bool selected;
/**
* Reference to the Sequence object that this command belongs to.
* This reference is only set at runtime (null in editor).
@ -103,6 +100,12 @@ namespace Fungus
}
}
/**
* Called when the new command is added to a sequence in the editor.
*/
public virtual void OnCommandAdded(Sequence parentSequence)
{}
public virtual void OnEnter()
{}

27
Assets/Fungus/FungusScript/Scripts/FungusScript.cs

@ -20,22 +20,22 @@ namespace Fungus
public Sequence executingSequence;
/**
* Scroll position of Fungus Script editor window (map view).
* Scroll position of Fungus Script editor window.
*/
[HideInInspector]
public Vector2 scriptScrollPos;
public Vector2 scrollPos;
/**
* Scroll position of Fungus Script editor window (command view).
* Zoom level of Fungus Script editor window
*/
[HideInInspector]
public Vector2 commandScrollPos;
public float zoom = 1f;
/**
* Current width of command view
* Scrollable area for Fungus Script editor window.
*/
[HideInInspector]
public float commandViewWidth = 350;
public Rect scrollViewRect;
/**
* Currently selected sequence in the Fungus Script editor.
@ -47,7 +47,7 @@ namespace Fungus
* Currently selected command in the Fungus Script editor.
*/
[HideInInspector]
public Command selectedCommand;
public List<Command> selectedCommands = new List<Command>();
/**
* The list of variables that can be accessed by the Fungus Script.
@ -379,18 +379,27 @@ namespace Fungus
*/
public virtual void UpdateHideFlags()
{
Sequence[] sequences = GetComponents<Sequence>();
Sequence[] sequences = GetComponentsInChildren<Sequence>();
foreach (Sequence sequence in sequences)
{
sequence.hideFlags = settings.hideComponents ? HideFlags.HideInInspector : HideFlags.None;
if (sequence.gameObject != gameObject)
{
sequence.gameObject.hideFlags = settings.hideComponents ? HideFlags.HideInHierarchy : HideFlags.None;
}
}
Command[] commands = GetComponents<Command>();
Command[] commands = GetComponentsInChildren<Command>();
foreach (Command command in commands)
{
command.hideFlags = settings.hideComponents ? HideFlags.HideInInspector : HideFlags.None;
}
}
public virtual void ClearSelectedCommands()
{
selectedCommands.Clear();
}
}
}

9
Assets/Fungus/FungusScript/Scripts/SceneLoader.cs

@ -46,11 +46,12 @@ namespace Fungus
yield return new WaitForEndOfFrame();
}
// Destroy tagged objects to release asset references
GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("DestroyOnSceneLoad");
foreach (GameObject go in gameObjects)
// Sprites tend to take up most of the memory in a Fungus game, so destroy all sprite objects
// first to free up memory for loading in the next scene.
SpriteRenderer[] renderers = GameObject.FindObjectsOfType<SpriteRenderer>();
foreach (SpriteRenderer renderer in renderers)
{
DestroyImmediate(go);
DestroyImmediate(renderer.gameObject);
}
// Wait for objects to actually be destroyed at end of run loop

4
Assets/Fungus/FungusScript/Scripts/Sequence.cs

@ -11,8 +11,6 @@ namespace Fungus
{
public string sequenceName = "New Sequence";
public string description = "";
[System.NonSerialized]
public Command activeCommand;
@ -142,7 +140,7 @@ namespace Fungus
activeCommand = null;
fungusScript.executingSequence = null;
fungusScript.selectedSequence = null;
fungusScript.selectedCommand = null;
fungusScript.selectedCommands.Clear();
}
public virtual List<Sequence> GetConnectedSequences()

2
Assets/Examples/Template_CYOA.meta → Assets/Fungus/iTween.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2c687730ee4c34a30991abc7996caac4
guid: 6e28dc60fedde4c22940b446dd7178b3
folderAsset: yes
DefaultImporter:
userData:

29
Assets/Fungus/iTween/MoveAdd.cs

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Move Add",
"Moves a game object by a specified offset over time.")]
public class MoveAdd : iTweenCommand
{
public Vector3 offset;
public Space space = Space.Self;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("amount", offset);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveAdd(target, tweenParams);
}
}
}

2
Assets/Fungus/Dialog/Editor/SetSayDialogEditor.cs.meta → Assets/Fungus/iTween/MoveAdd.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 571831413078e48d0bb29a408ee1ba71
guid: 598f181ee459641a9b0a5849fbc3240c
MonoImporter:
serializedVersion: 2
defaultReferences: []

29
Assets/Fungus/iTween/MoveTo.cs

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Move To",
"Moves a game object to a specified position over time.")]
public class MoveTo : iTweenCommand
{
public Vector3 position;
public bool isLocal;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("position", position);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.MoveTo(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/MoveTo.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 445c07472dafe4e0ead0e88c4b757401
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

29
Assets/Fungus/iTween/PunchPosition.cs

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Punch Position",
"Applies a jolt of force to a GameObject's position and wobbles it back to its initial position.")]
public class PunchPosition : iTweenCommand
{
public Vector3 amount;
public Space space = Space.Self;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("amount", amount);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchPosition(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/PunchPosition.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 720f059c883c4402c89fcc507d5f7e0d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

29
Assets/Fungus/iTween/PunchRotation.cs

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Punch Rotation",
"Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation.")]
public class PunchRotation : iTweenCommand
{
public Vector3 amount;
public Space space = Space.Self;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("amount", amount);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchRotation(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/PunchRotation.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ea1bc1400ac79424ba3c1aca77fb5d42
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

27
Assets/Fungus/iTween/PunchScale.cs

@ -0,0 +1,27 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Punch Scale",
"Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale.")]
public class PunchScale : iTweenCommand
{
public Vector3 amount;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("amount", amount);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.PunchScale(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/PunchScale.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ea4591c01defd496586e9b7237c966c5
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

29
Assets/Fungus/iTween/RotateAdd.cs

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Rotate Add",
"Rotates a game object by the specified angles over time.")]
public class RotateAdd : iTweenCommand
{
public Vector3 offset;
public Space space = Space.Self;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("amount", offset);
tweenParams.Add("space", space);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateAdd(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/RotateAdd.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a5d3c95fea3b45a595a9993dd9c3158
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

29
Assets/Fungus/iTween/RotateTo.cs

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Rotate To",
"Rotates a game object to the specified angles over time.")]
public class RotateTo : iTweenCommand
{
public Vector3 rotation;
public bool isLocal;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("rotation", rotation);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("isLocal", isLocal);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.RotateTo(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/RotateTo.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d2dd111db90064d2cb85e3370cdfe3ac
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

27
Assets/Fungus/iTween/ScaleAdd.cs

@ -0,0 +1,27 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Scale Add",
"Changes a game object's scale by a specified offset over time.")]
public class ScaleAdd : iTweenCommand
{
public Vector3 offset;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("amount", offset);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleAdd(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/ScaleAdd.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c4998e756a5d84f4ab55e075dad751b1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

27
Assets/Fungus/iTween/ScaleTo.cs

@ -0,0 +1,27 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Scale To",
"Changes a game object's scale to a specified value over time.")]
public class ScaleTo : iTweenCommand
{
public Vector3 scale;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("scale", scale);
tweenParams.Add("time", duration);
tweenParams.Add("easetype", easeType);
tweenParams.Add("looptype", loopType);
tweenParams.Add("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.ScaleTo(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/ScaleTo.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 665e8847cab3749f597622c6c52997ad
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

62
Assets/Fungus/iTween/iTweenCommand.cs

@ -0,0 +1,62 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
public abstract class iTweenCommand : Command
{
public GameObject target;
public float duration = 1f;
public iTween.EaseType easeType = iTween.EaseType.easeInOutQuad;
public iTween.LoopType loopType = iTween.LoopType.none;
public bool waitUntilFinished;
public override void OnEnter()
{
if (target == null)
{
Continue();
return;
}
DoTween();
if (!waitUntilFinished)
{
Continue();
}
}
public virtual void DoTween()
{}
protected virtual void OnComplete(object param)
{
Command command = param as Command;
if (command != null && command.Equals(this))
{
if (waitUntilFinished)
{
Continue();
}
}
}
public override string GetSummary()
{
if (target == null)
{
return "Error: No target object selected";
}
return target.gameObject.name + " over " + duration + " seconds";
}
public override Color GetButtonColor()
{
return new Color32(233, 163, 180, 255);
}
}
}

8
Assets/Fungus/iTween/iTweenCommand.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f7826996074154feba94755721eaa9d4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save