public override void OnInspectorGUI() { VideoScriptPlayableAsset videoAsset = (VideoScriptPlayableAsset)target; GUIStyle lStyle = GetLabelStyle(); GUILayout.Label("UI RawImage to play the video on:", lStyle); EditorGUILayout.PropertyField(rawImage); GUILayout.Space(10); VideoClip tempClip = videoAsset.videoClip; GUILayout.Label("Assign a Video Clip to Play:", lStyle); tempClip = (VideoClip)EditorGUILayout.ObjectField(tempClip, typeof(VideoClip), false); if (tempClip != videoAsset.videoClip && tempClip != null) { EditorUtility.DisplayDialog("New Clip Assigned", "Remember to make sure your video clip has 'Transcode' enabled in the Import Settings.", "Close"); } videoAsset.videoClip = tempClip; videoAsset.loop = EditorGUILayout.Toggle("Loop Video?", videoAsset.loop); GUILayout.Space(10); videoAsset.mute = EditorGUILayout.Toggle("Mute the video?", videoAsset.mute); if (!videoAsset.mute) { bool useDirectAudio = videoAsset.audioOutputMode == VideoAudioOutputMode.Direct; useDirectAudio = EditorGUILayout.Toggle("Use Direct Audio", useDirectAudio); if (useDirectAudio) { videoAsset.audioOutputMode = VideoAudioOutputMode.Direct; } else { EditorGUILayout.PropertyField(audioSource, new GUIContent("Audio Source")); if (PropertyName.IsNullOrEmpty(videoAsset.audioSource.exposedName)) { videoAsset.audioOutputMode = VideoAudioOutputMode.None; } else { videoAsset.audioOutputMode = VideoAudioOutputMode.AudioSource; } } } else { videoAsset.audioOutputMode = VideoAudioOutputMode.None; } GUILayout.Space(10); GUILayout.Label("Use these to clip seconds from the start and end of the video which you don't want to play:", lStyle); videoAsset.startTime = EditorGUILayout.DoubleField("Start Time", videoAsset.startTime); videoAsset.endTime = EditorGUILayout.DoubleField("End Time", videoAsset.endTime); GUILayout.Space(10); GUILayout.Label("Increase if you experience performance issues:", lStyle); videoAsset.preloadTime = EditorGUILayout.DoubleField("Preload Time", videoAsset.preloadTime); serializedObject.ApplyModifiedProperties(); }
/// <exception cref="InvalidOperationException">Invalid property type.</exception> internal virtual void Initialize() { if (PropertyName.IsNullOrEmpty()) { return; } escapedPropertyName = new[] { PropertyName }.RevertibleJoin( Modelling.Node.PathEscape, Modelling.Node.PathDelimiter); }
public void AddKey(string key) { for (int i = 0; i < keyOwn.Length; i++) { if (PropertyName.IsNullOrEmpty(keyOwn[i])) { if (key.Equals("hallwayKey")) { SpawnFinalEnemies(); } keyOwn[i] = key; return; } } }
/// <exception cref="InvalidOperationException">Invalid property type.</exception> internal override void Initialize() { base.Initialize(); if (PropertyName.IsNullOrEmpty()) { return; } var tNode = typeof(TNode); var tParent = typeof(TParent); var tProperty = typeof(TProperty); propertyInfo = tParent.GetProperty(PropertyName); if (propertyInfo == null) { throw new InvalidOperationException(string.Format( Strings.ExBindingFailedForX, tParent.GetShortName() + "." + PropertyName)); } if (propertyInfo.PropertyType != tProperty) { throw new InvalidOperationException(String.Format( Strings.ExTypeOfXPropertyMustBeY, propertyInfo.GetShortName(true), tProperty.GetShortName())); } isNestedToCollection = typeof(NodeCollection).IsAssignableFrom(tProperty); // Getter var typedGetter = DelegateHelper.CreateGetMemberDelegate <TParent, TProperty>(PropertyName); if (typedGetter == null) { throw new InvalidOperationException(string.Format( Strings.ExBindingFailedForX, propertyInfo.GetShortName(true))); } propertyGetter = n => typedGetter.Invoke((TParent)n); // Setter var typedSetter = DelegateHelper.CreateSetMemberDelegate <TParent, TProperty>(PropertyName); if (typedSetter == null) { throw new InvalidOperationException(string.Format( Strings.ExBindingFailedForX, propertyInfo.GetShortName(true))); } propertySetter = (n, v) => typedSetter.Invoke((TParent)n, (TProperty)v); }
static void CreateAnimationNodesFromSelection(object p_nodeType) { Transform[] selectedTransforms = SelectionUtils.GetTransformsFromSelection(); float zoom = DashEditorCore.EditorConfig.zoom; Vector2 viewOffset = DashEditorCore.EditorConfig.editingGraph.viewOffset; Vector2 position = new Vector2(_lastMousePosition.x * zoom - viewOffset.x, _lastMousePosition.y * zoom - viewOffset.y); Vector2 offset = Vector2.zero; foreach (Transform transform in selectedTransforms) { NodeBase node = NodeUtils.CreateNode(DashEditorCore.EditorConfig.editingGraph, (Type)p_nodeType, position + offset); if (node != null) { RetargetNodeModelBase model = node.GetModel() as RetargetNodeModelBase; model.retarget = true; //model.target.SetValue(transform.name); model.useReference = true; IExposedPropertyTable propertyTable = DashEditorCore.EditorConfig.editingController; bool isDefault = PropertyName.IsNullOrEmpty(model.targetReference.exposedName); if (isDefault) { PropertyName newExposedName = new PropertyName(GUID.Generate().ToString()); model.targetReference.exposedName = newExposedName; propertyTable.SetReferenceValue(newExposedName, transform); //p_fieldInfo.SetValue(p_object, exposedReference); } else { propertyTable.SetReferenceValue(model.targetReference.exposedName, transform); } // If its bindable bind all values to current transform if (node is IAnimationNodeBindable) { ((IAnimationNodeBindable)node).GetTargetFrom(transform); ((IAnimationNodeBindable)node).GetTargetTo(transform); } offset.y += node.Size.y + 24; } } }
public static int IsNullOrEmpty_s(IntPtr l) { int result; try { PropertyName prop; LuaObject.checkValueType <PropertyName>(l, 1, out prop); bool b = PropertyName.IsNullOrEmpty(prop); LuaObject.pushValue(l, true); LuaObject.pushValue(l, b); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
protected UnityEngine.Object Resolve(PropertyName exposedPropertyName, IExposedPropertyTable exposedPropertyTable, UnityEngine.Object defaultValue, out BaseExposedPropertyDrawer.OverrideState currentOverrideState) { UnityEngine.Object @object = null; bool flag = false; bool flag2 = !PropertyName.IsNullOrEmpty(exposedPropertyName); currentOverrideState = BaseExposedPropertyDrawer.OverrideState.DefaultValue; if (exposedPropertyTable != null) { @object = exposedPropertyTable.GetReferenceValue(exposedPropertyName, out flag); if (flag) { currentOverrideState = BaseExposedPropertyDrawer.OverrideState.Overridden; } else if (flag2) { currentOverrideState = BaseExposedPropertyDrawer.OverrideState.MissingOverride; } } return((currentOverrideState != BaseExposedPropertyDrawer.OverrideState.Overridden) ? defaultValue : @object); }
protected Object Resolve(PropertyName exposedPropertyName, IExposedPropertyTable exposedPropertyTable, Object defaultValue, out OverrideState currentOverrideState) { Object @object = null; bool idValid = false; bool flag = !PropertyName.IsNullOrEmpty(exposedPropertyName); currentOverrideState = OverrideState.DefaultValue; if (exposedPropertyTable != null) { @object = exposedPropertyTable.GetReferenceValue(exposedPropertyName, out idValid); if (idValid) { currentOverrideState = OverrideState.Overridden; } else if (flag) { currentOverrideState = OverrideState.MissingOverride; } } return((currentOverrideState == OverrideState.Overridden) ? @object : defaultValue); }
protected Object Resolve(PropertyName exposedPropertyName, IExposedPropertyTable exposedPropertyTable, Object defaultValue, out OverrideState currentOverrideState) { Object objReference = null; bool propertyFoundInTable = false; var propertyIsNamed = !PropertyName.IsNullOrEmpty(exposedPropertyName); currentOverrideState = OverrideState.DefaultValue; if (exposedPropertyTable != null) { objReference = exposedPropertyTable.GetReferenceValue(exposedPropertyName, out propertyFoundInTable); if (propertyFoundInTable) { currentOverrideState = OverrideState.Overridden; } else if (propertyIsNamed) { currentOverrideState = OverrideState.MissingOverride; } } return(currentOverrideState == OverrideState.Overridden ? objReference : defaultValue); }
public void OpenDoor() { if (PropertyName.IsNullOrEmpty(doorOpenRequire)) { doorTurning = true; isOpen = !isOpen; } else { if (ge.HasKey(doorOpenRequire)) { if (doorOpenRequire.Equals("hallwayKey")) { player.CallPlayerGameOverEvent(); } else { doorTurning = true; isOpen = !isOpen; } } //check global events for open... } }
static bool ExposedReferenceProperty(FieldInfo p_fieldInfo, Object p_object, GUIContent p_name, IReferencable p_reference) { if (!IsExposedReferenceProperty(p_fieldInfo)) { return(false); } IExposedPropertyTable propertyTable = DashEditorCore.EditorConfig.editingController; var exposedReference = p_fieldInfo.GetValue(p_object); PropertyName exposedName = (PropertyName)exposedReference.GetType().GetField("exposedName").GetValue(exposedReference); bool isDefault = PropertyName.IsNullOrEmpty(exposedName); GUILayout.BeginHorizontal(); GUILayout.Label(p_name, GUILayout.Width(160)); HandleReferencing(p_reference, p_fieldInfo); EditorGUI.BeginChangeCheck(); UnityEngine.Object exposedValue = (UnityEngine.Object)exposedReference.GetType().GetMethod("Resolve") .Invoke(exposedReference, new object[] { propertyTable }); var newValue = EditorGUILayout.ObjectField(exposedValue, p_fieldInfo.FieldType.GetGenericArguments()[0], true); GUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { if (propertyTable != null) { Undo.RegisterCompleteObjectUndo(propertyTable as UnityEngine.Object, "Set Exposed Property"); } if (!isDefault) { if (newValue == null) { propertyTable.ClearReferenceValue(exposedName); exposedReference.GetType().GetField("exposedName").SetValue(exposedReference, null); p_fieldInfo.SetValue(p_object, exposedReference); } else { propertyTable.SetReferenceValue(exposedName, newValue); } } else { if (newValue != null) { PropertyName newExposedName = new PropertyName(GUID.Generate().ToString()); exposedReference.GetType().GetField("exposedName") .SetValue(exposedReference, newExposedName); propertyTable.SetReferenceValue(newExposedName, newValue); p_fieldInfo.SetValue(p_object, exposedReference); } } return(true); } return(false); }
private void UpdateItemList() { foreach (Transform child in inventoryUIParent) { GameObject.Destroy(child.gameObject); } Item[] items = GetComponentInParent <PlayerInventory>().inventory; for (int i = 0; i < items.Length; i++) { if (!PropertyName.IsNullOrEmpty(items[i].itemName)) { GameObject uiObj; switch (items[i].itemType) { case ItemType.ammo: uiObj = Instantiate(uiObjects[GetAmmoInfo(items[i])]) as GameObject; uiObj.transform.SetParent(inventoryUIParent, false); uiObj.GetComponentInChildren <Text>().text = items[i].amount.ToString(); int temp = i; int dropAmount = 0; switch (items[i].weaponType) { case WeaponType.ar: dropAmount = 10; break; case WeaponType.sg: dropAmount = 3; break; case WeaponType.hg: dropAmount = 10; break; default: break; } uiObj.GetComponent <Button>().onClick.AddListener(delegate { if (isDiscarding) { player.CallPlayerDiscardItemEvent(temp, dropAmount); } else { player.CallPlayerUseItemEvent(temp, 1); } }); break; case ItemType.weapon: uiObj = Instantiate(uiObjects[GetWeaponInfo(items[i])]) as GameObject; uiObj.transform.SetParent(inventoryUIParent, false); uiObj.GetComponentInChildren <Text>().text = "1"; int tempWeapon = i; uiObj.GetComponent <Button>().onClick.AddListener(delegate { if (isDiscarding) { player.CallPlayerDiscardItemEvent(tempWeapon, 1); } else { player.CallPlayerUseItemEvent(tempWeapon, 1); } }); break; default: uiObj = Instantiate(uiObjects[GetItemInfo()]) as GameObject; uiObj.transform.SetParent(inventoryUIParent, false); uiObj.GetComponentInChildren <Text>().text = items[i].amount.ToString(); int tempItem = i; uiObj.GetComponent <Button>().onClick.AddListener(delegate { if (isDiscarding) { player.CallPlayerDiscardItemEvent(tempItem, 1); } else { player.CallPlayerUseItemEvent(tempItem, 1); } }); break; } } } }