Browse Source

Merge pull request #172 from FungusGames/remove-combo-box

Unity have added their own combo box in 5.2
master
Chris Gregan 9 years ago
parent
commit
932ca6431d
  1. 9
      Assets/Fungus/Thirdparty/ComboBox.meta
  2. 433
      Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab
  3. 8
      Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab.meta
  4. 798
      Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity
  5. 6
      Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity.meta
  6. 9
      Assets/Fungus/Thirdparty/ComboBox/Scripts.meta
  7. 681
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs
  8. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs.meta
  9. 115
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs
  10. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs.meta
  11. 9
      Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor.meta
  12. 107
      Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs
  13. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs.meta
  14. 56
      Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs
  15. 10
      Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs.meta

9
Assets/Fungus/Thirdparty/ComboBox.meta vendored

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 7bf9b0e9fb653414485c359a29badac7
folderAsset: yes
timeCreated: 1435835857
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

433
Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab vendored

@ -1,433 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &109132
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22455272}
m_Layer: 0
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &113240
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22408100}
- 222: {fileID: 22233812}
- 114: {fileID: 11484036}
- 225: {fileID: 22581862}
m_Layer: 0
m_Name: Arrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &124302
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22481784}
- 114: {fileID: 11481176}
m_Layer: 0
m_Name: ComboBox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &136152
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22497688}
- 222: {fileID: 22244812}
- 114: {fileID: 11435456}
m_Layer: 0
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &139690
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22450736}
- 222: {fileID: 22275660}
- 114: {fileID: 11443144}
- 114: {fileID: 11458428}
m_Layer: 0
m_Name: ComboButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &197142
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22408564}
- 222: {fileID: 22249438}
- 114: {fileID: 11463460}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &11435456
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136152}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 3
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.20000005
m_Text: Select item
--- !u!114 &11443144
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11458428
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 11443144}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &11463460
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197142}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11481176
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 124302}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 764efac649a181e4d8ab7e0941f263b4, type: 3}
m_Name:
m_EditorClassIdentifier:
Sprite_UISprite: {fileID: 0}
Sprite_Background: {fileID: 0}
_interactable: 1
_itemsToDisplay: 4
_hideFirstItem: 1
_selectedIndex: 0
_items:
- _caption: Select item
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 1
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 2
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 3
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 1
- _caption: Item 4
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 5
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 6
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 7
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
--- !u!114 &11484036
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u25BC"
--- !u!222 &22233812
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
--- !u!222 &22244812
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136152}
--- !u!222 &22249438
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197142}
--- !u!222 &22275660
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
--- !u!224 &22408100
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: .5, z: 1}
m_Children: []
m_Father: {fileID: 22455272}
m_RootOrder: 1
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 0}
m_Pivot: {x: 1, y: .5}
--- !u!224 &22408564
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 197142}
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: 22450736}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 4, y: -4}
m_SizeDelta: {x: 22, y: -8}
m_Pivot: {x: 0, y: 1}
--- !u!224 &22450736
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 139690}
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:
- {fileID: 22408564}
- {fileID: 22497688}
m_Father: {fileID: 22455272}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22455272
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 109132}
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:
- {fileID: 22450736}
- {fileID: 22408100}
m_Father: {fileID: 22481784}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22481784
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 124302}
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:
- {fileID: 22455272}
m_Father: {fileID: 0}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!224 &22497688
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136152}
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: 22450736}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: -6, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!225 &22581862
CanvasGroup:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 113240}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 124302}
m_IsPrefabParent: 1

8
Assets/Fungus/Thirdparty/ComboBox/ComboBox.prefab.meta vendored

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 65e6951c5bb5a4425876dde3504230f9
timeCreated: 1435836084
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

798
Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity vendored

@ -1,798 +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_ObjectHideFlags: 0
serializedVersion: 6
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_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 1
m_BakeResolution: 50
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 0
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_LightmapSnapshot: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &5
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666657
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &118098217
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 118098221}
- 223: {fileID: 118098220}
- 114: {fileID: 118098219}
- 114: {fileID: 118098218}
m_Layer: 0
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &118098218
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &118098219
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &118098220
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_Enabled: 1
serializedVersion: 2
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!224 &118098221
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 118098217}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 584710810}
m_Father: {fileID: 0}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &189900987
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 189900988}
- 222: {fileID: 189900991}
- 114: {fileID: 189900990}
- 225: {fileID: 189900989}
m_Layer: 0
m_Name: Arrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &189900988
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: .5, z: 1}
m_Children: []
m_Father: {fileID: 1075148776}
m_RootOrder: 1
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 0}
m_Pivot: {x: 1, y: .5}
--- !u!225 &189900989
CanvasGroup:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!114 &189900990
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: "\u25BC"
--- !u!222 &189900991
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 189900987}
--- !u!1 &556050592
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 556050593}
- 222: {fileID: 556050596}
- 114: {fileID: 556050595}
- 114: {fileID: 556050594}
m_Layer: 0
m_Name: ComboButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &556050593
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
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:
- {fileID: 1334474371}
- {fileID: 608930524}
m_Father: {fileID: 1075148776}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &556050594
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 556050595}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &556050595
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &556050596
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 556050592}
--- !u!1 &584710809
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 584710810}
- 114: {fileID: 584710811}
m_Layer: 0
m_Name: ComboBox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &584710810
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 584710809}
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:
- {fileID: 1075148776}
m_Father: {fileID: 118098221}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!114 &584710811
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 584710809}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 764efac649a181e4d8ab7e0941f263b4, type: 3}
m_Name:
m_EditorClassIdentifier:
Sprite_UISprite: {fileID: 0}
Sprite_Background: {fileID: 0}
_interactable: 1
_itemsToDisplay: 4
_hideFirstItem: 1
_selectedIndex: 0
_items:
- _caption: Select item
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 1
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 2
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 3
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 1
- _caption: Item 4
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 5
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
- _caption: Item 6
_image: {fileID: 0}
_isDisabled: 0
- _caption: Item 7
_image: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0}
_isDisabled: 0
--- !u!1 &608930523
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 608930524}
- 222: {fileID: 608930526}
- 114: {fileID: 608930525}
m_Layer: 0
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &608930524
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 608930523}
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: 556050593}
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: -6, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &608930525
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 608930523}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 3
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1.20000005
m_Text: Select item
--- !u!222 &608930526
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 608930523}
--- !u!1 &846109954
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 846109958}
- 114: {fileID: 846109957}
- 114: {fileID: 846109956}
- 114: {fileID: 846109955}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &846109955
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1997211142, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AllowActivationOnStandalone: 0
--- !u!114 &846109956
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
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_RepeatDelay: .5
m_AllowActivationOnMobileDevice: 0
--- !u!114 &846109957
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &846109958
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 846109954}
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 &1075148775
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1075148776}
m_Layer: 0
m_Name: Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1075148776
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1075148775}
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:
- {fileID: 556050593}
- {fileID: 189900988}
m_Father: {fileID: 584710810}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: .5}
m_AnchorMax: {x: .5, y: .5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: .5, y: .5}
--- !u!1 &1334474370
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 224: {fileID: 1334474371}
- 222: {fileID: 1334474373}
- 114: {fileID: 1334474372}
m_Layer: 0
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1334474371
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334474370}
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: 556050593}
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 4, y: -4}
m_SizeDelta: {x: 22, y: -8}
m_Pivot: {x: 0, y: 1}
--- !u!114 &1334474372
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334474370}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1334474373
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1334474370}
--- !u!1 &1383163942
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1383163944}
- 114: {fileID: 1383163943}
m_Layer: 0
m_Name: _FungusState
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1383163943
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1383163942}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedFlowchart: {fileID: 0}
--- !u!4 &1383163944
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1383163942}
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: 0
--- !u!1 &1771269060
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1771269065}
- 20: {fileID: 1771269064}
- 92: {fileID: 1771269063}
- 124: {fileID: 1771269062}
- 81: {fileID: 1771269061}
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 &1771269061
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
--- !u!124 &1771269062
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
--- !u!92 &1771269063
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
m_Enabled: 1
--- !u!20 &1771269064
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
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: 5
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
m_StereoMirrorMode: 0
--- !u!4 &1771269065
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1771269060}
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

6
Assets/Fungus/Thirdparty/ComboBox/ComboBoxTestScene.unity.meta vendored

@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: ce27f67d97a4b6e4f95525d833130c6e
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Fungus/Thirdparty/ComboBox/Scripts.meta vendored

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 57192e23792d2174ab616429b04425eb
folderAsset: yes
timeCreated: 1435835857
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

681
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs vendored

@ -1,681 +0,0 @@
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
[RequireComponent(typeof(RectTransform))]
public class ComboBox : MonoBehaviour
{
public Sprite Sprite_UISprite;
public Sprite Sprite_Background;
public Action<int> OnSelectionChanged;
[SerializeField]
private bool _interactable = true;
public bool Interactable
{
get
{
return _interactable;
}
set
{
_interactable = value;
var button = comboButtonRectTransform.GetComponent<Button>();
button.interactable = _interactable;
var image = comboImageRectTransform.GetComponent<Image>();
image.color = image.sprite == null ? new Color(1.0f, 1.0f, 1.0f, 0.0f) : _interactable ? button.colors.normalColor : button.colors.disabledColor;
if (!Application.isPlaying)
return;
if (!_interactable && overlayGO.activeSelf)
ToggleComboBox(false);
}
}
[SerializeField]
private int _itemsToDisplay = 4;
public int ItemsToDisplay
{
get
{
return _itemsToDisplay;
}
set
{
if (_itemsToDisplay == value)
return;
_itemsToDisplay = value;
Refresh();
}
}
[SerializeField]
private bool _hideFirstItem;
public bool HideFirstItem
{
get
{
return _hideFirstItem;
}
set
{
if (value)
scrollOffset--;
else
scrollOffset++;
_hideFirstItem = value;
Refresh();
}
}
[SerializeField]
private int _selectedIndex = 0;
public int SelectedIndex
{
get
{
return _selectedIndex;
}
set
{
if (_selectedIndex == value)
return;
if (value > -1 && value < Items.Length)
{
_selectedIndex = value;
RefreshSelected();
}
}
}
[SerializeField]
private ComboBoxItem[] _items;
public ComboBoxItem[] Items
{
get
{
if (_items == null)
_items = new ComboBoxItem[0];
return _items;
}
set
{
_items = value;
Refresh();
}
}
private GameObject overlayGO;
private int scrollOffset;
private float _scrollbarWidth = 20.0f;
private RectTransform _rectTransform;
private RectTransform rectTransform
{
get
{
if (_rectTransform == null)
_rectTransform = GetComponent<RectTransform>();
return _rectTransform;
}
set
{
_rectTransform = value;
}
}
private RectTransform _buttonRectTransform;
private RectTransform buttonRectTransform
{
get
{
if (_buttonRectTransform == null)
_buttonRectTransform = rectTransform.Find("Button").GetComponent<RectTransform>();
return _buttonRectTransform;
}
set
{
_buttonRectTransform = value;
}
}
private RectTransform _comboButtonRectTransform;
private RectTransform comboButtonRectTransform
{
get
{
if (_comboButtonRectTransform == null)
_comboButtonRectTransform = buttonRectTransform.Find("ComboButton").GetComponent<RectTransform>();
return _comboButtonRectTransform;
}
set
{
_comboButtonRectTransform = value;
}
}
private RectTransform _comboImageRectTransform;
private RectTransform comboImageRectTransform
{
get
{
if (_comboImageRectTransform == null)
_comboImageRectTransform = comboButtonRectTransform.Find("Image").GetComponent<RectTransform>();
return _comboImageRectTransform;
}
set
{
_comboImageRectTransform = value;
}
}
private RectTransform _comboTextRectTransform;
private RectTransform comboTextRectTransform
{
get
{
if (_comboTextRectTransform == null)
_comboTextRectTransform = comboButtonRectTransform.Find("Text").GetComponent<RectTransform>();
return _comboTextRectTransform;
}
set
{
_comboTextRectTransform = value;
}
}
private RectTransform _comboArrowRectTransform;
private RectTransform comboArrowRectTransform
{
get
{
if (_comboArrowRectTransform == null)
_comboArrowRectTransform = buttonRectTransform.Find("Arrow").GetComponent<RectTransform>();
return _comboArrowRectTransform;
}
set
{
_comboArrowRectTransform = value;
}
}
private RectTransform _scrollPanelRectTransfrom;
private RectTransform scrollPanelRectTransfrom
{
get
{
if (_scrollPanelRectTransfrom == null)
_scrollPanelRectTransfrom = rectTransform.Find("Overlay/ScrollPanel").GetComponent<RectTransform>();
return _scrollPanelRectTransfrom;
}
set
{
_scrollPanelRectTransfrom = value;
}
}
private RectTransform _itemsRectTransfrom;
private RectTransform itemsRectTransfrom
{
get
{
if (_itemsRectTransfrom == null)
_itemsRectTransfrom = scrollPanelRectTransfrom.Find("Items").GetComponent<RectTransform>();
return _itemsRectTransfrom;
}
set
{
_itemsRectTransfrom = value;
}
}
private RectTransform _scrollbarRectTransfrom;
private RectTransform scrollbarRectTransfrom
{
get
{
if (_scrollbarRectTransfrom == null)
_scrollbarRectTransfrom = scrollPanelRectTransfrom.Find("Scrollbar").GetComponent<RectTransform>();
return _scrollbarRectTransfrom;
}
set
{
_scrollbarRectTransfrom = value;
}
}
private RectTransform _slidingAreaRectTransform;
private RectTransform slidingAreaRectTransform
{
get
{
if (_slidingAreaRectTransform == null)
_slidingAreaRectTransform = scrollbarRectTransfrom.Find("SlidingArea").GetComponent<RectTransform>();
return _slidingAreaRectTransform;
}
set
{
_slidingAreaRectTransform = value;
}
}
private RectTransform _handleRectTransfrom;
private RectTransform handleRectTransfrom
{
get
{
if (_handleRectTransfrom == null)
_handleRectTransfrom = slidingAreaRectTransform.Find("Handle").GetComponent<RectTransform>();
return _handleRectTransfrom;
}
set
{
_handleRectTransfrom = value;
}
}
private void Awake()
{
InitControl();
}
public void OnItemClicked(int index)
{
var selectionChanged = index != SelectedIndex;
SelectedIndex = index;
ToggleComboBox(true);
if (selectionChanged && OnSelectionChanged != null)
OnSelectionChanged(index);
}
public void AddItems(params object[] list)
{
var cbItems = new List<ComboBoxItem>();
foreach (var obj in list)
{
if (obj is ComboBoxItem)
{
var item = (ComboBoxItem)obj;
cbItems.Add(item);
continue;
}
if (obj is string)
{
var item = new ComboBoxItem((string)obj, null, false, null);
cbItems.Add(item);
continue;
}
if (obj is Sprite)
{
var item = new ComboBoxItem(null, (Sprite)obj, false, null);
cbItems.Add(item);
continue;
}
throw new Exception("Only ComboBoxItem, string and Sprite types are allowed");
}
var newItems = new ComboBoxItem[Items.Length + cbItems.Count];
Items.CopyTo(newItems, 0);
cbItems.ToArray().CopyTo(newItems, Items.Length);
Refresh();
Items = newItems;
}
public void ClearItems()
{
Items = new ComboBoxItem[0];
}
public void CreateControl()
{
rectTransform = GetComponent<RectTransform>();
var buttonGO = new GameObject("Button");
buttonGO.transform.SetParent(transform, false);
buttonRectTransform = buttonGO.AddComponent<RectTransform>();
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x);
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y);
buttonRectTransform.anchoredPosition = Vector2.zero;
var comboButtonGO = new GameObject("ComboButton");
comboButtonGO.transform.SetParent(buttonRectTransform, false);
comboButtonRectTransform = comboButtonGO.AddComponent<RectTransform>();
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, buttonRectTransform.sizeDelta.x);
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, buttonRectTransform.sizeDelta.y);
comboButtonRectTransform.anchoredPosition = Vector2.zero;
var comboButtonImage = comboButtonGO.AddComponent<Image>();
comboButtonImage.sprite = Sprite_UISprite;
comboButtonImage.type = Image.Type.Sliced;
var comboButtonButton = comboButtonGO.AddComponent<Button>();
comboButtonButton.targetGraphic = comboButtonImage;
var comboButtonColors = new ColorBlock();
comboButtonColors.normalColor = new Color32(255, 255, 255, 255);
comboButtonColors.highlightedColor = new Color32(245, 245, 245, 255);
comboButtonColors.pressedColor = new Color32(200, 200, 200, 255);
comboButtonColors.disabledColor = new Color32(200, 200, 200, 128);
comboButtonColors.colorMultiplier = 1.0f;
comboButtonColors.fadeDuration = 0.1f;
comboButtonButton.colors = comboButtonColors;
var comboArrowGO = new GameObject("Arrow");
comboArrowGO.transform.SetParent(buttonRectTransform, false);
var comboArrowText = comboArrowGO.AddComponent<Text>();
comboArrowText.color = new Color32(0, 0, 0, 255);
comboArrowText.alignment = TextAnchor.MiddleCenter;
comboArrowText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
comboArrowText.text = "▼";
comboArrowRectTransform.localScale = new Vector3(1.0f, 0.5f, 1.0f);
comboArrowRectTransform.pivot = new Vector2(1.0f, 0.5f);
comboArrowRectTransform.anchorMin = Vector2.right;
comboArrowRectTransform.anchorMax = Vector2.one;
comboArrowRectTransform.anchoredPosition = Vector2.zero;
comboArrowRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboButtonRectTransform.sizeDelta.y);
comboArrowRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, comboButtonRectTransform.sizeDelta.y);
var comboArrowCanvasGroup = comboArrowGO.AddComponent<CanvasGroup>();
comboArrowCanvasGroup.interactable = false;
comboArrowCanvasGroup.blocksRaycasts = false;
var comboImageGO = new GameObject("Image");
comboImageGO.transform.SetParent(comboButtonRectTransform, false);
var comboImageImage = comboImageGO.AddComponent<Image>();
comboImageImage.color = new Color32(255, 255, 255, 0);
comboImageRectTransform.pivot = Vector2.up;
comboImageRectTransform.anchorMin = Vector2.zero;
comboImageRectTransform.anchorMax = Vector2.up;
comboImageRectTransform.anchoredPosition = new Vector2(4.0f, -4.0f);
comboImageRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboButtonRectTransform.sizeDelta.y - 8.0f);
comboImageRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, comboButtonRectTransform.sizeDelta.y - 8.0f);
var comboTextGO = new GameObject("Text");
comboTextGO.transform.SetParent(comboButtonRectTransform, false);
var comboTextText = comboTextGO.AddComponent<Text>();
comboTextText.color = new Color32(0, 0, 0, 255);
comboTextText.alignment = TextAnchor.MiddleLeft;
comboTextText.lineSpacing = 1.2f;
comboTextText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
comboTextRectTransform.pivot = Vector2.up;
comboTextRectTransform.anchorMin = Vector2.zero;
comboTextRectTransform.anchorMax = Vector2.one;
comboTextRectTransform.anchoredPosition = new Vector2(10.0f, 0.0f);
comboTextRectTransform.offsetMax = new Vector2(4.0f, 0.0f);
comboTextRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, comboButtonRectTransform.sizeDelta.y);
}
public void InitControl()
{
var cbi = transform.Find("Button/ComboButton/Image");
var cbt = transform.Find("Button/ComboButton/Text");
var cba = transform.Find("Button/Arrow");
if (cbi == null || cbt == null || cba == null)
{
foreach (Transform child in transform)
Destroy(child);
CreateControl();
}
comboButtonRectTransform.GetComponent<Button>().onClick.AddListener(() => { ToggleComboBox(false); });
var dropdownHeight = comboButtonRectTransform.sizeDelta.y * Mathf.Min(ItemsToDisplay, Items.Length - (HideFirstItem ? 1 : 0));
overlayGO = new GameObject("Overlay");
overlayGO.SetActive(false);
var overlayImage = overlayGO.AddComponent<Image>();
overlayImage.color = new Color32(0, 0, 0, 0);
var canvasTransform = transform;
while (canvasTransform.GetComponent<Canvas>() == null)
canvasTransform = canvasTransform.parent;
overlayGO.transform.SetParent(canvasTransform, false);
var overlayRectTransform = overlayGO.GetComponent<RectTransform>();
overlayRectTransform.anchorMin = Vector2.zero;
overlayRectTransform.anchorMax = Vector2.one;
overlayRectTransform.offsetMin = Vector2.zero;
overlayRectTransform.offsetMax = Vector2.zero;
overlayGO.transform.SetParent(transform, false);
var overlayButton = overlayGO.AddComponent<Button>();
overlayButton.targetGraphic = overlayImage;
overlayButton.onClick.AddListener(() => { ToggleComboBox(false); });
var scrollPanelGO = new GameObject("ScrollPanel");
var scrollPanelImage = scrollPanelGO.AddComponent<Image>();
scrollPanelImage.sprite = Sprite_UISprite;
scrollPanelImage.type = Image.Type.Sliced;
scrollPanelGO.transform.SetParent(overlayGO.transform, false);
scrollPanelRectTransfrom.pivot = new Vector2(0.5f, 1.0f);
scrollPanelRectTransfrom.anchorMin = Vector2.zero;
scrollPanelRectTransfrom.anchorMax = Vector2.one;
scrollPanelGO.transform.SetParent(transform, false);
scrollPanelRectTransfrom.anchoredPosition = new Vector2(0.0f, -comboButtonRectTransform.sizeDelta.y);
scrollPanelGO.transform.SetParent(overlayGO.transform, false);
scrollPanelRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboButtonRectTransform.sizeDelta.x);
scrollPanelRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
var scrollPanelScrollRect = scrollPanelGO.AddComponent<ScrollRect>();
scrollPanelScrollRect.horizontal = false;
scrollPanelScrollRect.elasticity = 0.0f;
scrollPanelScrollRect.movementType = ScrollRect.MovementType.Clamped;
scrollPanelScrollRect.inertia = false;
scrollPanelScrollRect.scrollSensitivity = comboButtonRectTransform.sizeDelta.y;
scrollPanelGO.AddComponent<Mask>();
var scrollbarWidth = Items.Length - (HideFirstItem ? 1 : 0) > _itemsToDisplay ? _scrollbarWidth : 0.0f;
var itemsGO = new GameObject("Items");
itemsGO.transform.SetParent(scrollPanelGO.transform, false);
itemsRectTransfrom = itemsGO.AddComponent<RectTransform>();
itemsRectTransfrom.pivot = Vector2.up;
itemsRectTransfrom.anchorMin = Vector2.up;
itemsRectTransfrom.anchorMax = Vector2.one;
itemsRectTransfrom.anchoredPosition = Vector2.right;
itemsRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollPanelRectTransfrom.sizeDelta.x - scrollbarWidth);
var itemsContentSizeFitter = itemsGO.AddComponent<ContentSizeFitter>();
itemsContentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
itemsContentSizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var itemsGridLayoutGroup = itemsGO.AddComponent<GridLayoutGroup>();
itemsGridLayoutGroup.cellSize = new Vector2(comboButtonRectTransform.sizeDelta.x - scrollbarWidth, comboButtonRectTransform.sizeDelta.y);
itemsGridLayoutGroup.constraint = GridLayoutGroup.Constraint.FixedColumnCount;
itemsGridLayoutGroup.constraintCount = 1;
scrollPanelScrollRect.content = itemsRectTransfrom;
var scrollbarGO = new GameObject("Scrollbar");
scrollbarGO.transform.SetParent(scrollPanelGO.transform, false);
var scrollbarImage = scrollbarGO.AddComponent<Image>();
scrollbarImage.sprite = Sprite_Background;
scrollbarImage.type = Image.Type.Sliced;
var scrollbarScrollbar = scrollbarGO.AddComponent<Scrollbar>();
var scrollbarColors = new ColorBlock();
scrollbarColors.normalColor = new Color32(128, 128, 128, 128);
scrollbarColors.highlightedColor = new Color32(128, 128, 128, 178);
scrollbarColors.pressedColor = new Color32(88, 88, 88, 178);
scrollbarColors.disabledColor = new Color32(64, 64, 64, 128);
scrollbarColors.colorMultiplier = 2.0f;
scrollbarColors.fadeDuration = 0.1f;
scrollbarScrollbar.colors = scrollbarColors;
scrollPanelScrollRect.verticalScrollbar = scrollbarScrollbar;
scrollbarScrollbar.direction = Scrollbar.Direction.BottomToTop;
scrollbarRectTransfrom.pivot = Vector2.one;
scrollbarRectTransfrom.anchorMin = Vector2.one;
scrollbarRectTransfrom.anchorMax = Vector2.one;
scrollbarRectTransfrom.anchoredPosition = Vector2.zero;
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollbarWidth);
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
var slidingAreaGO = new GameObject("SlidingArea");
slidingAreaGO.transform.SetParent(scrollbarGO.transform, false);
slidingAreaRectTransform = slidingAreaGO.AddComponent<RectTransform>();
slidingAreaRectTransform.anchoredPosition = Vector2.zero;
slidingAreaRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
slidingAreaRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight - scrollbarRectTransfrom.sizeDelta.x);
var handleGO = new GameObject("Handle");
handleGO.transform.SetParent(slidingAreaGO.transform, false);
var handleImage = handleGO.AddComponent<Image>();
handleImage.sprite = Sprite_UISprite;
handleImage.type = Image.Type.Sliced;
handleImage.color = new Color32(255, 255, 255, 150);
scrollbarScrollbar.targetGraphic = handleImage;
scrollbarScrollbar.handleRect = handleRectTransfrom;
handleRectTransfrom.pivot = new Vector2(0.5f, 0.5f);
handleRectTransfrom.anchorMin = new Vector2(0.5f, 0.5f);
handleRectTransfrom.anchorMax = new Vector2(0.5f, 0.5f);
handleRectTransfrom.anchoredPosition = Vector2.zero;
handleRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollbarWidth);
handleRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, scrollbarWidth);
Interactable = Interactable;
if (Items.Length < 1)
return;
Refresh();
}
public void Refresh()
{
var itemsGridLayoutGroup = itemsRectTransfrom.GetComponent<GridLayoutGroup>();
var itemsLength = Items.Length - (HideFirstItem ? 1 : 0);
var dropdownHeight = comboButtonRectTransform.sizeDelta.y * Mathf.Min(_itemsToDisplay, itemsLength);
var scrollbarWidth = itemsLength > ItemsToDisplay ? _scrollbarWidth : 0.0f;
scrollPanelRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollbarWidth);
scrollbarRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight);
slidingAreaRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, dropdownHeight - scrollbarRectTransfrom.sizeDelta.x);
itemsRectTransfrom.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollPanelRectTransfrom.sizeDelta.x - scrollbarWidth);
itemsGridLayoutGroup.cellSize = new Vector2(comboButtonRectTransform.sizeDelta.x - scrollbarWidth, comboButtonRectTransform.sizeDelta.y);
for (var i = itemsRectTransfrom.childCount - 1; i > -1; i--)
DestroyImmediate(itemsRectTransfrom.GetChild(0).gameObject);
for (var i = 0; i < Items.Length; i++)
{
if (HideFirstItem && i == 0)
continue;
var item = Items[i];
item.OnUpdate = Refresh;
var itemTransform = Instantiate(comboButtonRectTransform) as Transform;
itemTransform.SetParent(itemsRectTransfrom, false);
itemTransform.GetComponent<Image>().sprite = null;
var itemText = itemTransform.Find("Text").GetComponent<Text>();
itemText.text = item.Caption;
if (item.IsDisabled)
itemText.color = new Color32(174, 174, 174, 255);
var itemImage = itemTransform.Find("Image").GetComponent<Image>();
itemImage.sprite = item.Image;
itemImage.color = item.Image == null ? new Color32(255, 255, 255, 0) : item.IsDisabled ? new Color32(255, 255, 255, 147) : new Color32(255, 255, 255, 255);
var itemButton = itemTransform.GetComponent<Button>();
itemButton.interactable = !item.IsDisabled;
var index = i;
itemButton.onClick.AddListener(
delegate()
{
OnItemClicked(index);
if (item.OnSelect != null)
item.OnSelect();
}
);
}
RefreshSelected();
UpdateComboBoxImages();
UpdateGraphics();
FixScrollOffset();
}
public void RefreshSelected()
{
var comboButtonImage = comboImageRectTransform.GetComponent<Image>();
var item = SelectedIndex > -1 && SelectedIndex < Items.Length ? Items[SelectedIndex] : null;
var includeImage = item != null && item.Image != null;
comboButtonImage.sprite = includeImage ? item.Image : null;
var comboButtonButton = comboButtonRectTransform.GetComponent<Button>();
comboButtonImage.color = includeImage ? (Interactable ? comboButtonButton.colors.normalColor : comboButtonButton.colors.disabledColor) : new Color(1.0f, 1.0f, 1.0f, 0);
UpdateComboBoxImage(comboButtonRectTransform, includeImage);
comboTextRectTransform.GetComponent<Text>().text = item != null ? item.Caption : "";
if (!Application.isPlaying)
return;
var i = 0;
foreach (Transform child in itemsRectTransfrom)
{
comboButtonImage = child.GetComponent<Image>();
comboButtonImage.color = SelectedIndex == i + (HideFirstItem ? 1 : 0) ? comboButtonButton.colors.highlightedColor : comboButtonButton.colors.normalColor;
i++;
}
}
private void UpdateComboBoxImages()
{
var includeImages = false;
foreach (var item in Items)
{
if (item.Image != null)
{
includeImages = true;
break;
}
}
foreach (Transform child in itemsRectTransfrom)
UpdateComboBoxImage(child, includeImages);
}
private void UpdateComboBoxImage(Transform comboButton, bool includeImage)
{
comboButton.Find("Text").GetComponent<RectTransform>().offsetMin = Vector2.right * (includeImage ? comboImageRectTransform.rect.width + 8.0f : 10.0f);
}
private void FixScrollOffset()
{
var selectedIndex = SelectedIndex + (HideFirstItem ? 1 : 0);
if (selectedIndex < scrollOffset)
scrollOffset = selectedIndex;
else
if (selectedIndex > scrollOffset + ItemsToDisplay - 1)
scrollOffset = selectedIndex - ItemsToDisplay + 1;
var itemsCount = Items.Length - (HideFirstItem ? 1 : 0);
if (scrollOffset > itemsCount - ItemsToDisplay)
scrollOffset = itemsCount - ItemsToDisplay;
if (scrollOffset < 0)
scrollOffset = 0;
itemsRectTransfrom.anchoredPosition = new Vector2(0.0f, scrollOffset * rectTransform.sizeDelta.y);
}
private void ToggleComboBox(bool directClick)
{
overlayGO.SetActive(!overlayGO.activeSelf);
if (overlayGO.activeSelf)
{
var curTransform = transform;
do
{
curTransform.SetAsLastSibling();
}
while ((curTransform = curTransform.parent) != null);
FixScrollOffset();
}
else
if (directClick)
scrollOffset = (int)Mathf.Round(itemsRectTransfrom.anchoredPosition.y / rectTransform.sizeDelta.y);
}
public void UpdateGraphics()
{
if (overlayGO != null)
{
var scrollbarWidth = Items.Length - (HideFirstItem ? 1 : 0) > ItemsToDisplay ? _scrollbarWidth : 0.0f;
handleRectTransfrom.offsetMin = -scrollbarWidth / 2 * Vector2.one;
handleRectTransfrom.offsetMax = scrollbarWidth / 2 * Vector2.one;
}
if (rectTransform.sizeDelta != buttonRectTransform.sizeDelta && buttonRectTransform.sizeDelta == comboButtonRectTransform.sizeDelta)
{
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x);
buttonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y);
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x);
comboButtonRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y);
comboArrowRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.y);
comboImageRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, comboImageRectTransform.rect.height);
comboTextRectTransform.offsetMax = new Vector2(4.0f, 0.0f);
if (overlayGO == null)
return;
scrollPanelRectTransfrom.SetParent(transform, false);
scrollPanelRectTransfrom.anchoredPosition = new Vector2(0.0f, -comboButtonRectTransform.sizeDelta.y);
scrollPanelRectTransfrom.SetParent(overlayGO.transform, false);
scrollPanelRectTransfrom.GetComponent<ScrollRect>().scrollSensitivity = comboButtonRectTransform.sizeDelta.y;
UpdateComboBoxImage(comboButtonRectTransform, Items[SelectedIndex].Image != null);
Refresh();
}
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBox.cs.meta vendored

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 764efac649a181e4d8ab7e0941f263b4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

115
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs vendored

@ -1,115 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using System;
[Serializable]
public class ComboBoxItem
{
[SerializeField]
private string _caption;
public string Caption
{
get
{
return _caption;
}
set
{
_caption = value;
if (OnUpdate != null)
OnUpdate();
}
}
[SerializeField]
private Sprite _image;
public Sprite Image
{
get
{
return _image;
}
set
{
_image = value;
if (OnUpdate != null)
OnUpdate();
}
}
[SerializeField]
private bool _isDisabled;
public bool IsDisabled
{
get
{
return _isDisabled;
}
set
{
_isDisabled = value;
if (OnUpdate != null)
OnUpdate();
}
}
public Action OnSelect;
internal Action OnUpdate;
public ComboBoxItem(string caption)
{
_caption = caption;
}
public ComboBoxItem(Sprite image)
{
_image = image;
}
public ComboBoxItem(string caption, bool disabled)
{
_caption = caption;
_isDisabled = disabled;
}
public ComboBoxItem(Sprite image, bool disabled)
{
_image = image;
_isDisabled = disabled;
}
public ComboBoxItem(string caption, Sprite image, bool disabled)
{
_caption = caption;
_image = image;
_isDisabled = disabled;
}
public ComboBoxItem(string caption, Sprite image, bool disabled, Action onSelect)
{
_caption = caption;
_image = image;
_isDisabled = disabled;
OnSelect = onSelect;
}
public ComboBoxItem(string caption, Sprite image, Action onSelect)
{
_caption = caption;
_image = image;
OnSelect = onSelect;
}
public ComboBoxItem(string caption, Action onSelect)
{
_caption = caption;
OnSelect = onSelect;
}
public ComboBoxItem(Sprite image, Action onSelect)
{
_image = image;
OnSelect = onSelect;
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/ComboBoxItem.cs.meta vendored

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: d9b9c26a5d250434c8acd6e66bf53f5f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor.meta vendored

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

107
Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs vendored

@ -1,107 +0,0 @@
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(ComboBox))]
public class ComboBoxEditor : Editor
{
public override void OnInspectorGUI()
{
var comboBoxGO = target as ComboBox;
var allowUpdate = comboBoxGO.transform.Find("Button") != null;
if (allowUpdate)
comboBoxGO.UpdateGraphics();
EditorGUI.BeginChangeCheck();
DrawDefaultInspector();
if (EditorGUI.EndChangeCheck())
{
if (Application.isPlaying)
{
comboBoxGO.HideFirstItem = comboBoxGO.HideFirstItem;
comboBoxGO.Interactable = comboBoxGO.Interactable;
}
else
if (allowUpdate)
comboBoxGO.RefreshSelected();
}
}
}
public class ComboBoxMenuItem
{
[MenuItem("GameObject/UI/ComboBox")]
public static void CreateComboBox()
{
var canvas = Object.FindObjectOfType<Canvas>();
var canvasGO = canvas == null ? null : canvas.gameObject;
if (canvasGO == null)
{
canvasGO = new GameObject("Canvas");
canvas = canvasGO.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasGO.AddComponent<CanvasScaler>();
canvasGO.AddComponent<GraphicRaycaster>();
}
var eventSystem = Object.FindObjectOfType<EventSystem>();
var eventSystemGO = eventSystem == null ? null : eventSystem.gameObject;
if (eventSystemGO == null)
{
eventSystemGO = new GameObject("EventSystem");
eventSystem = eventSystemGO.AddComponent<EventSystem>();
eventSystemGO.AddComponent<StandaloneInputModule>();
eventSystemGO.AddComponent<TouchInputModule>();
}
var comboBoxGO = new GameObject("ComboBox");
comboBoxGO.transform.SetParent(canvasGO.transform, false);
var rTransform = comboBoxGO.AddComponent<RectTransform>();
rTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160);
rTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 30);
for (var i = 0; i < Selection.objects.Length; i++)
{
var selected = Selection.objects[i] as GameObject;
var hierarchyItem = selected.transform;
canvas = null;
while (hierarchyItem != null && (canvas = hierarchyItem.GetComponent<Canvas>()) == null)
hierarchyItem = hierarchyItem.parent;
if (canvas != null)
{
comboBoxGO.transform.SetParent(selected.transform, false);
break;
}
}
rTransform.anchoredPosition = Vector2.zero;
var comboBox = comboBoxGO.AddComponent<ComboBox>();
LoadAssets();
comboBox.Sprite_UISprite = Sprite_UISprite;
comboBox.Sprite_Background = Sprite_Background;
comboBox.CreateControl();
Selection.activeGameObject = comboBoxGO;
}
private static Sprite Sprite_UISprite;
private static Sprite Sprite_Background;
public static void LoadAssets()
{
while (Sprite_UISprite == null || Sprite_Background == null)
{
var sprites = Resources.FindObjectsOfTypeAll<Sprite>();
foreach (var sprite in sprites)
switch (sprite.name)
{
case "UISprite":
Sprite_UISprite = sprite;
break;
case "Background":
Sprite_Background = sprite;
break;
}
if (Sprite_UISprite == null || Sprite_Background == null)
AssetDatabase.LoadAllAssetsAtPath("Resources/unity_builtin_extra");
}
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/Editor/ComboBoxEditor.cs.meta vendored

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: ce7fb92090fdb7c478c9bbe01617dc56
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

56
Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs vendored

@ -1,56 +0,0 @@
using UnityEngine;
public class TestComboBox : MonoBehaviour
{
public ComboBox comboBox;
public Sprite image;
private void Start()
{
var itemMakeBig = new ComboBoxItem("Make me big!");
var itemMakeNormal = new ComboBoxItem("Normal", image, true);
var itemMakeSmall = new ComboBoxItem("Make me small!");
itemMakeBig.OnSelect += () =>
{
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 180);
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 40);
comboBox.UpdateGraphics();
itemMakeBig.Caption = "Big";
itemMakeBig.IsDisabled = true;
itemMakeNormal.Caption = "Make me normal!";
itemMakeNormal.IsDisabled = false;
itemMakeSmall.Caption = "Make me small!";
itemMakeSmall.IsDisabled = false;
};
itemMakeNormal.OnSelect += () =>
{
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160);
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 30);
comboBox.UpdateGraphics();
itemMakeBig.Caption = "Make me big!";
itemMakeBig.IsDisabled = false;
itemMakeNormal.Caption = "Normal";
itemMakeNormal.IsDisabled = true;
itemMakeSmall.Caption = "Make me small!";
itemMakeSmall.IsDisabled = false;
};
itemMakeSmall.OnSelect += () =>
{
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 160);
comboBox.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 20);
comboBox.UpdateGraphics();
itemMakeBig.Caption = "Make me big!";
itemMakeBig.IsDisabled = false;
itemMakeNormal.Caption = "Make me normal!";
itemMakeNormal.IsDisabled = false;
itemMakeSmall.Caption = "Small";
itemMakeSmall.IsDisabled = true;
};
comboBox.AddItems(itemMakeBig, itemMakeNormal, itemMakeSmall);
comboBox.SelectedIndex = 1;
comboBox.OnSelectionChanged += (int index) =>
{
Camera.main.backgroundColor = new Color32((byte)Random.Range(0, 256), (byte)Random.Range(0, 256), (byte)Random.Range(0, 256), 255);
};
}
}

10
Assets/Fungus/Thirdparty/ComboBox/Scripts/TestComboBox.cs.meta vendored

@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 04953fda07e4b074e922be8606477017
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save