/// <summary> /// Handle changes to the health attribute /// </summary> /// <param name="rAttribute"></param> /// <param name="rOldValue"></param> protected virtual void OnAttributeValueChanged(BasicAttribute rAttribute, object rOldValue) { BasicAttributeFloat lAttributeFloat = rAttribute as BasicAttributeFloat; if (lAttributeFloat == null || lAttributeFloat.ID.ToUpperInvariant() != _HealthKey.ToUpperInvariant()) { return; } if (_ShowDebugInfo) { Debug.Log(string.Format("[{0}] {1} value changed: {2} [{3}]", GetType().Name, lAttributeFloat._ID, lAttributeFloat.GetValue <float>(), (float)rOldValue)); } if (_UseEasing) { StartCoroutine(ChangeSliderValue(lAttributeFloat.Value, _HealthBar)); } else { _HealthBar.value = lAttributeFloat.Value; } }
/// <summary> /// Renders the currently selected step /// </summary> /// <param name="rStep"></param> private bool DrawAttributeItemDetail(BasicAttribute rItem) { bool lIsDirty = false; EditorHelper.DrawSmallTitle("Attribute - " + EnumAttributeTypes.GetName(rItem.ValueType)); bool lIsValueDirty = rItem.OnInspectorGUI(mTarget); if (lIsValueDirty) { lIsDirty = true; } return(lIsDirty); }
/// <summary> /// Allows us to stop before removing the item /// </summary> /// <param name="rList"></param> private void OnItemListItemRemove(ReorderableList rList) { if (EditorUtility.DisplayDialog("Warning!", "Are you sure you want to delete the item?", "Yes", "No")) { int lIndex = rList.index; BasicAttribute lAttibute = mTarget.Items[lIndex]; rList.index--; mTarget.RemoveAttribute(lAttibute); OnItemListItemSelect(rList); mIsDirty = true; } }
/// <summary> /// Allows us to draw each item in the list /// </summary> /// <param name="rRect"></param> /// <param name="rIndex"></param> /// <param name="rIsActive"></param> /// <param name="rIsFocused"></param> private void DrawAttributeItemListItem(Rect rRect, int rIndex, bool rIsActive, bool rIsFocused) { if (rIndex < mTarget.Items.Count) { BasicAttribute lItem = mTarget.Items[rIndex]; rRect.y += 2; float lNameWidth = EditorGUIUtility.labelWidth; Rect lNameRect = new Rect(rRect.x, rRect.y, lNameWidth, EditorGUIUtility.singleLineHeight); EditorGUI.LabelField(lNameRect, lItem.ID); Rect lValueRect = new Rect(rRect.x + lNameWidth + 5f, rRect.y, rRect.width - (lNameWidth + 5f), EditorGUIUtility.singleLineHeight); bool lIsDirty = lItem.OnInspectorGUI(lValueRect); if (lIsDirty) { mIsDirty = true; } } }
public virtual void SetupMocks() { mockContext = Org.Mockito.Mockito.Mock <DirContext>(); Org.Mockito.Mockito.DoReturn(mockContext).When(mappingSpy).GetDirContext(); SearchResult mockUserResult = Org.Mockito.Mockito.Mock <SearchResult>(); // We only ever call hasMoreElements once for the user NamingEnum, so // we can just have one return value Org.Mockito.Mockito.When(mockUserNamingEnum.MoveNext()).ThenReturn(true); Org.Mockito.Mockito.When(mockUserNamingEnum.Current).ThenReturn(mockUserResult); Org.Mockito.Mockito.When(mockUserResult.GetNameInNamespace()).ThenReturn("CN=some_user,DC=test,DC=com" ); SearchResult mockGroupResult = Org.Mockito.Mockito.Mock <SearchResult>(); // We're going to have to define the loop here. We want two iterations, // to get both the groups Org.Mockito.Mockito.When(mockGroupNamingEnum.MoveNext()).ThenReturn(true, true, false ); Org.Mockito.Mockito.When(mockGroupNamingEnum.Current).ThenReturn(mockGroupResult); // Define the attribute for the name of the first group Attribute group1Attr = new BasicAttribute("cn"); group1Attr.Add(testGroups[0]); Attributes group1Attrs = new BasicAttributes(); group1Attrs.Put(group1Attr); // Define the attribute for the name of the second group Attribute group2Attr = new BasicAttribute("cn"); group2Attr.Add(testGroups[1]); Attributes group2Attrs = new BasicAttributes(); group2Attrs.Put(group2Attr); // This search result gets reused, so return group1, then group2 Org.Mockito.Mockito.When(mockGroupResult.GetAttributes()).ThenReturn(group1Attrs, group2Attrs); }
public void ShowRestRoomUI(BasicAttribute force, BasicAttribute agile, BasicAttribute constitution) { RestDesc.text = "HPを" + DungeonManager.Ins.RestEfficiency * 100 + "%回復"; gameObject.SetActive(true); ForceLevelCount.text = "STR強化Lv." + force.currentLv + ""; AgileLevelCount.text = "AGI強化Lv." + agile.currentLv + ""; ConstitutionLevelCount.text = "INT強化Lv." + constitution.currentLv + ""; ForceTrainingBtn.interactable = !force.IsMaxLv(); AgileTrainingBtn.interactable = !agile.IsMaxLv(); ConstitutionTrainingBtn.interactable = !constitution.IsMaxLv(); ForceRewardDesc.text = "現段階の効果\n" + CardType.攻撃 + "カードを最大" + Initializer.Ins.AttrLvInfos[CharacterInDungeon.Ins.Force.currentLv - 1].LvName + "までアップグレード解禁"; AgileRewardDesc.text = "現段階の効果\n" + CardType.防御 + "カードを最大" + Initializer.Ins.AttrLvInfos[CharacterInDungeon.Ins.Agile.currentLv - 1].LvName + "までアップグレード解禁"; ConstitutionRewardDesc.text = "現段階の効果\n" + CardType.技能 + "カードを最大" + Initializer.Ins.AttrLvInfos[CharacterInDungeon.Ins.Constitution.currentLv - 1].LvName + "までアップグレード解禁"; if (force.IsMaxLv()) { ForceExp.text = "MAX"; ForceSlider.value = 1; ForceTrainingDesc.SetActive(!force.IsMaxLv()); } else { ForceExp.text = force.currentExp + " / " + force.maxExp; ForceSlider.value = (float)force.currentExp / force.maxExp; ForceTrainingDesc.SetActive(true); ForceTrainingDesc.GetComponent <Text>().text = "強化ポイントを<color=#FFC000>" + DungeonManager.Ins.ForceExp_Per_Training + "</color>獲得"; } if (agile.IsMaxLv()) { AgileExp.text = "MAX"; AgileSlider.value = 1; AgileTrainingDesc.SetActive(!agile.IsMaxLv()); } else { AgileExp.text = agile.currentExp + " / " + agile.maxExp; AgileSlider.value = (float)agile.currentExp / agile.maxExp; AgileTrainingDesc.SetActive(true); AgileTrainingDesc.GetComponent <Text>().text = "強化ポイントを<color=#FFC000>" + DungeonManager.Ins.AgileExp_Per_Training + "</color>獲得"; } if (constitution.IsMaxLv()) { ConstitutionExp.text = "MAX"; ConstitutionSlider.value = 1; ConstitutionTrainingDesc.SetActive(!constitution.IsMaxLv()); } else { ConstitutionExp.text = constitution.currentExp + " / " + constitution.maxExp; ConstitutionSlider.value = (float)constitution.currentExp / constitution.maxExp; ConstitutionTrainingDesc.SetActive(true); ConstitutionTrainingDesc.GetComponent <Text>().text = "強化ポイントを<color=#FFC000>" + DungeonManager.Ins.ConstitutionExp_Per_Training + "</color>獲得"; } }
/// <summary> /// Draws the inspector for the pack /// </summary> /// <returns></returns> public static bool OnPackInspector(MotionController rMotionController) { EditorHelper.DrawSmallTitle(GroupName()); EditorHelper.DrawLink("Mixamo Pro Magic Pack Animations", "http://www.ootii.com/Unity/MotionPacks/SpellCasting/SpellCastingUsersGuide.pdf"); GUILayout.Space(5f); EditorGUILayout.LabelField("See included documentation:", EditorHelper.SmallBoldLabel); EditorGUILayout.LabelField("1. Download and import animations.", EditorHelper.SmallLabel); EditorGUILayout.LabelField("2. Unzip and replace animation meta files.", EditorHelper.SmallLabel); EditorGUILayout.LabelField("3. Select options and create motions.", EditorHelper.SmallLabel); EditorHelper.DrawLine(); EditorHelper.BoolField("Create Mecanim States", "Determines if we create/override the existing sub-state machine", sCreateSubStateMachines); sCreateSubStateMachines = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Input Aliases", "Determines if we create input aliases", sCreateInputAliases); sCreateInputAliases = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Inventory", "Determines if we create/override the existing inventory", sCreateInventory); sCreateInventory = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Attributes", "Determines if we create/override the existing attributes", sCreateAttributes); sCreateAttributes = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Spell Inventory", "Create the spell inventory for the caster", sCreateSpellInventory); sCreateSpellInventory = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Combatant", "Determines if we create/override the existing core", sCreateCore); sCreateCore = EditorHelper.FieldBoolValue; EditorHelper.BoolField("Create Motions", "Determines if we create the archery motions", sCreateMotions); sCreateMotions = EditorHelper.FieldBoolValue; GUILayout.Space(5f); if (GUILayout.Button(new GUIContent("Setup Pack", "Create and setup the motion pack."), EditorStyles.miniButton)) { if (sCreateInventory) { BasicInventory lInventory = rMotionController.gameObject.GetComponent <BasicInventory>(); if (lInventory == null) { lInventory = rMotionController.gameObject.AddComponent <BasicInventory>(); } BasicInventoryItem lItem = lInventory.GetInventoryItem("Spell_01"); if (lItem != null) { lInventory.Items.Remove(lItem); } lInventory.Items.Add(new BasicInventoryItem()); lInventory.Items[lInventory.Items.Count - 1].ID = "Spell_01"; lInventory.Items[lInventory.Items.Count - 1].EquipMotion = "PMP_EquipSpell"; lInventory.Items[lInventory.Items.Count - 1].StoreMotion = "PMP_StoreSpell"; BasicInventorySlot lSlot = lInventory.GetInventorySlot("RIGHT_HAND"); if (lSlot == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "RIGHT_HAND"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } if (lInventory.GetInventorySlot("LEFT_HAND") == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "LEFT_HAND"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } lSlot = lInventory.GetInventorySlot("LEFT_LOWER_ARM"); if (lSlot == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "LEFT_LOWER_ARM"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } if (lInventory.GetInventorySlot("READY_PROJECTILE") == null) { lInventory.Slots.Add(new BasicInventorySlot()); lInventory.Slots[lInventory.Slots.Count - 1].ID = "READY_PROJECTILE"; lInventory.Slots[lInventory.Slots.Count - 1].ItemID = ""; } BasicInventorySet lWeaponSet = lInventory.GetWeaponSet("Spell Casting"); if (lWeaponSet != null) { lInventory.WeaponSets.Remove(lWeaponSet); } lWeaponSet = new BasicInventorySet(); lWeaponSet.ID = "Spell Casting"; BasicInventorySetItem lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "LEFT_HAND"; lWeaponSetItem.Instantiate = true; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "READY_PROJECTILE"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = "Spell_01"; lWeaponSetItem.SlotID = "RIGHT_HAND"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); lWeaponSetItem = new BasicInventorySetItem(); lWeaponSetItem.ItemID = ""; lWeaponSetItem.SlotID = "LEFT_LOWER_ARM"; lWeaponSetItem.Instantiate = false; lWeaponSet.Items.Add(lWeaponSetItem); if (lInventory.WeaponSets.Count == 0) { BasicInventorySet lFirstWeaponSet = new BasicInventorySet(); lFirstWeaponSet.ID = "Sword and Shield"; lInventory.WeaponSets.Add(lFirstWeaponSet); } if (lInventory.WeaponSets.Count == 1) { BasicInventorySet lSecondWeaponSet = new BasicInventorySet(); lSecondWeaponSet.ID = "Longbow"; lInventory.WeaponSets.Add(lSecondWeaponSet); } lInventory.WeaponSets.Insert(2, lWeaponSet); } if (sCreateAttributes) { BasicAttributes lAttributes = rMotionController.gameObject.GetComponent <BasicAttributes>(); if (lAttributes == null) { lAttributes = rMotionController.gameObject.AddComponent <BasicAttributes>(); } BasicAttribute lAttribute = lAttributes.GetAttribute("Health"); if (lAttribute != null) { lAttributes.Items.Remove(lAttribute); } lAttributes.Items.Add(new BasicAttribute()); lAttributes.Items[lAttributes.Items.Count - 1].ID = "Health"; lAttributes.Items[lAttributes.Items.Count - 1].SetValue <float>(100f); } if (sCreateSpellInventory) { SpellInventory lAttributes = rMotionController.gameObject.GetComponent <SpellInventory>(); if (lAttributes == null) { lAttributes = rMotionController.gameObject.AddComponent <SpellInventory>(); } } if (sCreateCore) { Combatant lCombatant = rMotionController.gameObject.GetComponent <Combatant>(); if (lCombatant == null) { lCombatant = rMotionController.gameObject.AddComponent <Combatant>(); } if (rMotionController._ActorController == null || !rMotionController._ActorController.UseTransformPosition) { lCombatant.IsLockingEnabled = true; lCombatant.TargetLockedIcon = AssetDatabase.LoadAssetAtPath <Texture>("Assets/ootii/Framework_v1/Content/Textures/UI/TargetIcon_2.png"); } ActorCore lCore = rMotionController.gameObject.GetComponent <ActorCore>(); if (lCore == null) { lCore = rMotionController.gameObject.AddComponent <ActorCore>(); } lCore.IsAlive = true; } if (sCreateInputAliases) { // Sheathe if (!InputManagerHelper.IsDefined("Spell Casting Equip")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Equip"; lEntry.PositiveButton = "3"; // "3" key lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Equip"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.JoyNum = 0; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 8"; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; // D-pad Y lEntry.Axis = 0; #else lEntry.PositiveButton = ""; lEntry.Type = InputManagerEntryType.JOYSTICK_AXIS; // D-pad Y lEntry.Axis = 7; #endif InputManagerHelper.AddEntry(lEntry, true); } // Fire if (!InputManagerHelper.IsDefined("Spell Casting Cast")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cast"; lEntry.PositiveButton = "left ctrl"; lEntry.AltPositiveButton = "mouse 0"; // Left mouse button lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cast"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 16"; // Green A #else lEntry.PositiveButton = "joystick button 0"; // Green A #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Continue if (!InputManagerHelper.IsDefined("Spell Casting Continue")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Continue"; lEntry.PositiveButton = "left ctrl"; lEntry.AltPositiveButton = "mouse 0"; // Left mouse button lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Continue"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 16"; // Green A #else lEntry.PositiveButton = "joystick button 0"; // Green A #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Cancel if (!InputManagerHelper.IsDefined("Spell Casting Cancel")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cancel"; lEntry.PositiveButton = "escape"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); lEntry = new InputManagerEntry(); lEntry.Name = "Spell Casting Cancel"; #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX lEntry.PositiveButton = "joystick button 19"; // Yellow Y #else lEntry.PositiveButton = "joystick button 3"; // Yellow Y #endif lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Move Up if (!InputManagerHelper.IsDefined("Move Up")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Move Up"; lEntry.PositiveButton = "e"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } // Move down if (!InputManagerHelper.IsDefined("Move Down")) { InputManagerEntry lEntry = new InputManagerEntry(); lEntry.Name = "Move Down"; lEntry.PositiveButton = "q"; lEntry.Gravity = 1000; lEntry.Dead = 0.001f; lEntry.Sensitivity = 1000; lEntry.Type = InputManagerEntryType.KEY_MOUSE_BUTTON; lEntry.Axis = 0; lEntry.JoyNum = 0; InputManagerHelper.AddEntry(lEntry, true); } } if (sCreateMotions || sCreateSubStateMachines) { IBaseCameraRig lCameraRig = rMotionController.CameraRig; if (lCameraRig == null) { lCameraRig = rMotionController.ExtractCameraRig(rMotionController.CameraTransform); } if (rMotionController.MotionLayers.Count == 0) { MotionControllerLayer lMotionLayer = new MotionControllerLayer(); rMotionController.MotionLayers.Add(lMotionLayer); } PMP_Idle lIdle = rMotionController.GetMotion <PMP_Idle>(); if (lIdle == null) { lIdle = rMotionController.CreateMotion <PMP_Idle>(0); } PMP_EquipSpell lEquip = rMotionController.GetMotion <PMP_EquipSpell>(0); if (lEquip == null) { lEquip = rMotionController.CreateMotion <PMP_EquipSpell>(0); } PMP_StoreSpell lStore = rMotionController.GetMotion <PMP_StoreSpell>(0); if (lStore == null) { lStore = rMotionController.CreateMotion <PMP_StoreSpell>(0); } PMP_WalkRunPivot lPivot = rMotionController.GetMotion <PMP_WalkRunPivot>(0); if (lPivot == null) { lPivot = rMotionController.CreateMotion <PMP_WalkRunPivot>(0); } PMP_WalkRunStrafe lStrafe = rMotionController.GetMotion <PMP_WalkRunStrafe>(0); if (lStrafe == null) { lStrafe = rMotionController.CreateMotion <PMP_WalkRunStrafe>(0); } PMP_BasicSpellCastings lCast = rMotionController.GetMotion <PMP_BasicSpellCastings>(0); if (lCast == null) { lCast = rMotionController.CreateMotion <PMP_BasicSpellCastings>(0); } Cower lCower = rMotionController.GetMotion <Cower>(0); if (lCower == null) { lCower = rMotionController.CreateMotion <Cower>(0); } Death lDeath = rMotionController.GetMotion <Death>(0); if (lDeath == null) { lDeath = rMotionController.CreateMotion <Death>(0); } Damaged lDamaged = rMotionController.GetMotion <Damaged>(0); if (lDamaged == null) { lDamaged = rMotionController.CreateMotion <Damaged>(0); } Frozen lFrozen = rMotionController.GetMotion <Frozen>(0); if (lFrozen == null) { lFrozen = rMotionController.CreateMotion <Frozen>(0); } KnockedDown lKnockedDown = rMotionController.GetMotion <KnockedDown>(0); if (lKnockedDown == null) { lKnockedDown = rMotionController.CreateMotion <KnockedDown>(0); } Levitate lLevitate = rMotionController.GetMotion <Levitate>(0); if (lLevitate == null) { lLevitate = rMotionController.CreateMotion <Levitate>(0); } PushedBack lPushedBack = rMotionController.GetMotion <PushedBack>(0); if (lPushedBack == null) { lPushedBack = rMotionController.CreateMotion <PushedBack>(0); } Sleep lSleep = rMotionController.GetMotion <Sleep>(0); if (lSleep == null) { lSleep = rMotionController.CreateMotion <Sleep>(0); } Stunned lStunned = rMotionController.GetMotion <Stunned>(0); if (lStunned == null) { lStunned = rMotionController.CreateMotion <Stunned>(0); } if (sCreateSubStateMachines) { Animator lAnimator = rMotionController.Animator; if (lAnimator == null) { lAnimator = rMotionController.gameObject.GetComponent <Animator>(); } if (lAnimator != null) { UnityEditor.Animations.AnimatorController lAnimatorController = lAnimator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController; lIdle.CreateStateMachine(lAnimatorController); lEquip.CreateStateMachine(lAnimatorController); lPivot.CreateStateMachine(lAnimatorController); lStrafe.CreateStateMachine(lAnimatorController); lCast.CreateStateMachine(lAnimatorController); lDeath.CreateStateMachine(lAnimatorController); lLevitate.CreateStateMachine(lAnimatorController); } } } EditorUtility.DisplayDialog("Motion Pack: " + GroupName(), "Motion pack imported.", "ok"); return(true); } return(false); }
public void ShowRestRoomUI(BasicAttribute force, BasicAttribute agile, BasicAttribute constitution) { RestDesc.text = "恢复" + DungeonManager.Ins.RestEfficiency * 100 + "%生命值"; gameObject.SetActive(true); ForceLevelCount.text = "力量强化Lv." + force.currentLv + ""; AgileLevelCount.text = "敏捷强化Lv." + agile.currentLv + ""; ConstitutionLevelCount.text = "智力强化Lv." + constitution.currentLv + ""; ForceTrainingBtn.interactable = !force.IsMaxLv(); AgileTrainingBtn.interactable = !agile.IsMaxLv(); ConstitutionTrainingBtn.interactable = !constitution.IsMaxLv(); ForceRewardDesc.text = "当前效果\n最高可以将" + CardType.攻击 + "卡升至" + Initializer.Ins.AttrLvInfos[CharacterInDungeon.Ins.Force.currentLv - 1].LvName; AgileRewardDesc.text = "当前效果\n最高可以将" + CardType.防御 + "卡升至" + Initializer.Ins.AttrLvInfos[CharacterInDungeon.Ins.Agile.currentLv - 1].LvName; ConstitutionRewardDesc.text = "当前效果\n最高可以将" + CardType.技能 + "卡升至" + Initializer.Ins.AttrLvInfos[CharacterInDungeon.Ins.Constitution.currentLv - 1].LvName; if (force.IsMaxLv()) { ForceExp.text = "MAX"; ForceSlider.value = 1; ForceTrainingDesc.SetActive(!force.IsMaxLv()); } else { ForceExp.text = force.currentExp + " / " + force.maxExp; ForceSlider.value = (float)force.currentExp / force.maxExp; ForceTrainingDesc.SetActive(true); ForceTrainingDesc.GetComponent <Text>().text = "提升<color=#FFC000>" + DungeonManager.Ins.ForceExp_Per_Training + "</color>点强化点数"; } if (agile.IsMaxLv()) { AgileExp.text = "MAX"; AgileSlider.value = 1; AgileTrainingDesc.SetActive(!agile.IsMaxLv()); } else { AgileExp.text = agile.currentExp + " / " + agile.maxExp; AgileSlider.value = (float)agile.currentExp / agile.maxExp; AgileTrainingDesc.SetActive(true); AgileTrainingDesc.GetComponent <Text>().text = "提升<color=#FFC000>" + DungeonManager.Ins.AgileExp_Per_Training + "</color>点强化点数"; } if (constitution.IsMaxLv()) { ConstitutionExp.text = "MAX"; ConstitutionSlider.value = 1; ConstitutionTrainingDesc.SetActive(!constitution.IsMaxLv()); } else { ConstitutionExp.text = constitution.currentExp + " / " + constitution.maxExp; ConstitutionSlider.value = (float)constitution.currentExp / constitution.maxExp; ConstitutionTrainingDesc.SetActive(true); ConstitutionTrainingDesc.GetComponent <Text>().text = "提升<color=#FFC000>" + DungeonManager.Ins.ConstitutionExp_Per_Training + "</color>点强化点数"; } }
/// <summary> /// Renders the currently selected step /// </summary> /// <param name="rStep"></param> private bool DrawItemDetail(BasicAttribute rItem) { bool lIsDirty = false; EditorHelper.DrawSmallTitle(rItem.ID.Length > 0 ? rItem.ID : "Attribute Item"); float lLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 70f; if (EditorHelper.TextField("ID", "Unique ID of the Item", rItem.ID, mTarget)) { lIsDirty = true; rItem.ID = EditorHelper.FieldStringValue; } int lIndex = EnumAttributeTypes.GetEnum(rItem.ValueType); if (EditorHelper.PopUpField("Type", "Data type the attribute holds", lIndex, EnumAttributeTypes.Names, mTarget)) { lIsDirty = true; rItem.ValueType = EnumAttributeTypes.Types[EditorHelper.FieldIntValue]; } if (rItem.ValueType != null) { GUILayout.Space(5f); } if (rItem.ValueType == typeof(float)) { if (EditorHelper.FloatField("Value", "Value of the attribute", rItem.GetValue <float>(), mTarget)) { lIsDirty = true; rItem.SetValue <float>(EditorHelper.FieldFloatValue); } } else if (rItem.ValueType == typeof(int)) { if (EditorHelper.IntField("Value", "Value of the attribute", rItem.GetValue <int>(), mTarget)) { lIsDirty = true; rItem.SetValue <int>(EditorHelper.FieldIntValue); } } else if (rItem.ValueType == typeof(bool)) { if (EditorHelper.BoolField("Value", "Value of the attribute", rItem.GetValue <bool>(), mTarget)) { lIsDirty = true; rItem.SetValue <bool>(EditorHelper.FieldBoolValue); } } else if (rItem.ValueType == typeof(string)) { if (EditorHelper.TextField("Value", "Value of the attribute", rItem.GetValue <string>(), mTarget)) { lIsDirty = true; rItem.SetValue <string>(EditorHelper.FieldStringValue); } } else if (rItem.ValueType == typeof(Vector2)) { if (EditorHelper.Vector2Field("Value", "Value of the attribute", rItem.GetValue <Vector2>(), mTarget)) { lIsDirty = true; rItem.SetValue <Vector2>(EditorHelper.FieldVector2Value); } } else if (rItem.ValueType == typeof(Vector3)) { if (EditorHelper.Vector3Field("Value", "Value of the attribute", rItem.GetValue <Vector3>(), mTarget)) { lIsDirty = true; rItem.SetValue <Vector3>(EditorHelper.FieldVector3Value); } } else if (rItem.ValueType == typeof(Vector4)) { #if UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 Vector4 lValue = EditorGUILayout.Vector4Field("Value", rItem.GetValue <Vector4>()); #else Vector4 lValue = EditorGUILayout.Vector4Field(new GUIContent("Value", "Value of the attribute"), rItem.GetValue <Vector4>()); #endif if (lValue != rItem.GetValue <Vector4>()) { lIsDirty = true; rItem.SetValue <Vector4>(lValue); } } else if (rItem.ValueType == typeof(Quaternion)) { if (EditorHelper.QuaternionField("Value", "Value of the attribute", rItem.GetValue <Quaternion>(), mTarget)) { lIsDirty = true; rItem.SetValue <Quaternion>(EditorHelper.FieldQuaternionValue); } } else if (rItem.ValueType == typeof(Transform)) { if (EditorHelper.ObjectField <Transform>("Value", "Value of the attribute", rItem.GetValue <Transform>(), mTarget)) { lIsDirty = true; rItem.SetValue <Transform>(EditorHelper.FieldObjectValue as Transform); } } else if (rItem.ValueType == typeof(GameObject)) { if (EditorHelper.ObjectField <GameObject>("Value", "Value of the attribute", rItem.GetValue <GameObject>(), mTarget)) { lIsDirty = true; rItem.SetValue <GameObject>(EditorHelper.FieldObjectValue as GameObject); } } EditorGUIUtility.labelWidth = lLabelWidth; return(lIsDirty); }
/// <summary> /// Allows us to draw each item in the list /// </summary> /// <param name="rRect"></param> /// <param name="rIndex"></param> /// <param name="rIsActive"></param> /// <param name="rIsFocused"></param> private void DrawItemListItem(Rect rRect, int rIndex, bool rIsActive, bool rIsFocused) { if (rIndex < mTarget.Items.Count) { BasicAttribute lItem = mTarget.Items[rIndex]; rRect.y += 2; float lWidth = (rRect.width - 5f) * 0.5f; Rect lNameRect = new Rect(rRect.x, rRect.y, lWidth, EditorGUIUtility.singleLineHeight); EditorGUI.LabelField(lNameRect, lItem.ID); Rect lValueRect = new Rect(lNameRect.x + lNameRect.width + 0.5f, lNameRect.y, lWidth, EditorGUIUtility.singleLineHeight); if (lItem.ValueType == typeof(float)) { float lOldValue = lItem.GetValue <float>(); float lNewValue = EditorGUI.FloatField(lValueRect, lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <float>(lNewValue); } } else if (lItem.ValueType == typeof(int)) { int lOldValue = lItem.GetValue <int>(); int lNewValue = EditorGUI.IntField(lValueRect, lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <int>(lNewValue); } } else if (lItem.ValueType == typeof(bool)) { bool lOldValue = lItem.GetValue <bool>(); bool lNewValue = EditorGUI.Toggle(lValueRect, lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <bool>(lNewValue); } } else if (lItem.ValueType == typeof(string)) { string lOldValue = lItem.GetValue <string>(); string lNewValue = EditorGUI.TextField(lValueRect, lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <string>(lNewValue); } } else if (lItem.ValueType == typeof(Vector2)) { Vector2 lOldValue = lItem.GetValue <Vector2>(); Vector2 lNewValue = EditorGUI.Vector2Field(lValueRect, "", lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <Vector2>(lNewValue); } } else if (lItem.ValueType == typeof(Vector3)) { Vector3 lOldValue = lItem.GetValue <Vector3>(); Vector3 lNewValue = EditorGUI.Vector3Field(lValueRect, "", lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <Vector3>(lNewValue); } } else if (lItem.ValueType == typeof(Vector4)) { Vector4 lOldValue = lItem.GetValue <Vector4>(); Vector4 lNewValue = EditorGUI.Vector4Field(lValueRect, "", lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <Vector4>(lNewValue); } } else if (lItem.ValueType == typeof(Quaternion)) { Vector3 lOldValue = lItem.GetValue <Quaternion>().eulerAngles; Vector3 lNewValue = EditorGUI.Vector3Field(lValueRect, "", lOldValue); if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <Quaternion>(Quaternion.Euler(lNewValue)); } } else if (lItem.ValueType == typeof(Transform)) { Transform lOldValue = lItem.GetValue <Transform>(); Transform lNewValue = EditorGUI.ObjectField(lValueRect, lOldValue, typeof(Transform), true) as Transform; if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <Transform>(lNewValue); } } else if (lItem.ValueType == typeof(GameObject)) { GameObject lOldValue = lItem.GetValue <GameObject>(); GameObject lNewValue = EditorGUI.ObjectField(lValueRect, lOldValue, typeof(GameObject), true) as GameObject; if (lNewValue != lOldValue) { mIsDirty = true; lItem.SetValue <GameObject>(lNewValue); } } } }