浏览代码

[Bot] Automated dotnet-format update

/main
itsLevi0sa 3 年前
当前提交
0425b39f
共有 2 个文件被更改,包括 105 次插入105 次删除
  1. 2
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/HasHitHeadConditionSO.cs
  2. 208
      UOP1_Project/Assets/Scripts/Quests/Editor/QuestEditorWindow.cs

2
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/HasHitHeadConditionSO.cs


bool isMovingUpwards = _protagonistScript.movementVector.y > 0f;
if (isMovingUpwards)
{
if(_characterController.collisionFlags == CollisionFlags.Above)
if (_characterController.collisionFlags == CollisionFlags.Above)
{
_protagonistScript.jumpInput = false;
_protagonistScript.movementVector.y = 0f;

208
UOP1_Project/Assets/Scripts/Quests/Editor/QuestEditorWindow.cs


public static void ShowWindow()
{
QuestEditorWindow wnd = GetWindow<QuestEditorWindow>();
wnd.titleContent = new GUIContent("QuestEditorWindow");
// Sets a minimum size to the window.
wnd.titleContent = new GUIContent("QuestEditorWindow");
// Sets a minimum size to the window.
{
// Opens the window, otherwise focuses it if it’s already open.
QuestEditorWindow window = GetWindow<QuestEditorWindow>();
// Adds a title to the window.
window.titleContent = new GUIContent("QuestEditorWindow");
// Sets a minimum size to the window.
window.minSize = new Vector2(250, 250);
//window.SetTool();
{
// Opens the window, otherwise focuses it if it’s already open.
QuestEditorWindow window = GetWindow<QuestEditorWindow>();
// Adds a title to the window.
window.titleContent = new GUIContent("QuestEditorWindow");
// Sets a minimum size to the window.
window.minSize = new Vector2(250, 250);
//window.SetTool();
VisualElement root = rootVisualElement;
// Import UXML
VisualElement root = rootVisualElement;
// Import UXML
root.Add(visualTree.CloneTree());
//Import USS
root.Add(visualTree.CloneTree());
//Import USS
root.styleSheets.Add(styleSheet);
//Register button event
root.styleSheets.Add(styleSheet);
//Register button event
Button refreshQuestPreviewBtn = root.Q<Button>("refresh-preview-btn");
refreshQuestPreviewBtn.RegisterCallback<ClickEvent>((evt) => SetUpQuestPreview(_currentSeletedQuest));

private void LoadAllQuestsData()
{
//Load all questlines
{
//Load all questlines
FindAllSOByType(out QuestlineSO[] questLineSOs);
RefreshListView(out ListView allQuestlinesListView, "questlines-list", questLineSOs);
ClearElements(selectionType.Questline);

_idStepSelected = allStepsListView.selectedIndex;
_currentSelectedStep = GetDataFromListViewItem<StepSO>(stepEnumerable);
DisplayAllProperties(_currentSelectedStep, "step-info-scroll");
ClearElements(selectionType.Step);
//Find all DialogueDataSOs in the same folder of the StepSO
ClearElements(selectionType.Step);
//Find all DialogueDataSOs in the same folder of the StepSO
FindAllDialogueInStep(_currentSelectedStep, out DialogueDataSO[] dialogueDataSOs);
if (dialogueDataSOs != null)
{

};
}
VisualElement DialogueList = rootVisualElement.Q<VisualElement>("dialogues-list");
SetAddDialogueButtonsForStep(out VisualElement ButtonsPanel);
//DialogueList.Q<VisualElement>("buttons-panel").Clear();
SetAddDialogueButtonsForStep(out VisualElement ButtonsPanel);
//DialogueList.Q<VisualElement>("buttons-panel").Clear();
DialogueList.Add(ButtonsPanel);
};

EditorUtility.SetDirty(_currentSeletedQuest);
AssetDatabase.SaveAssets();
_currentSelectedStep.DialogueBeforeStep = asset;
asset.DialogueType = DialogueType.StartDialogue;
// asset.CreateLine();
asset.DialogueType = DialogueType.StartDialogue;
// asset.CreateLine();
rootVisualElement.Q<VisualElement>("steps-list").Q<ListView>().SetSelection(_idStepSelected);
}
private void AddCompletionDialogue()

AssetDatabase.CreateAsset(asset, "Assets/ScriptableObjects/Quests/Questline" + questlineId + "/Quest" + questId + "/Step" + stepId + "/CD-S" + stepId + "-Q" + questId + "-QL" + questlineId + ".asset");
_currentSelectedStep.CompleteDialogue = asset;
asset.DialogueType = DialogueType.CompletionDialogue;
// asset.CreateLine();
asset.DialogueType = DialogueType.CompletionDialogue;
// asset.CreateLine();
EditorUtility.SetDirty(asset);
EditorUtility.SetDirty(_currentSeletedQuest);
AssetDatabase.SaveAssets();

stepId = _currentSeletedQuest.Steps.FindIndex(o => o == _currentSelectedStep) + 1;
AssetDatabase.CreateAsset(asset, "Assets/ScriptableObjects/Quests/Questline" + questlineId + "/Quest" + questId + "/Step" + stepId + "/ID-S" + stepId + "-Q" + questId + "-QL" + questlineId + ".asset");
asset.DialogueType = DialogueType.IncompletionDialogue;
//asset.CreateLine();
asset.DialogueType = DialogueType.IncompletionDialogue;
//asset.CreateLine();
_currentSelectedStep.IncompleteDialogue = asset;
EditorUtility.SetDirty(asset);
EditorUtility.SetDirty(_currentSeletedQuest);

}
private void LoadAndInitStepUXML(StepSO step)
{
//Clear actor conversations area
ScrollView actorConversationsVE = rootVisualElement.Q<ScrollView>("actor-conversations");
// Import UXML
{
//Clear actor conversations area
ScrollView actorConversationsVE = rootVisualElement.Q<ScrollView>("actor-conversations");
// Import UXML
VisualElement dialogueAreaVE = stepVE.Q<VisualElement>("dialogue-area");
//Title
VisualElement dialogueAreaVE = stepVE.Q<VisualElement>("dialogue-area");
//Title
stepVE.Q<Label>("step-title-label").text = "Step" + step.name[1];
//IsDone
stepVE.Q<Label>("step-title-label").text = "Step" + step.name[1];
//IsDone
Toggle isDoneToggle = stepVE.Q<Toggle>("step-done-toggle");
isDoneToggle.value = step.IsDone;
isDoneToggle.SetEnabled(false);

if (dialogueToPreview != null)
{
//setPreview Actor for each step
{
//setPreview Actor for each step
Image actorPreview = LoadActorImage(step.Actor.name);
//Add Image
Image actorPreview = LoadActorImage(step.Actor.name);
//Add Image
}
//Type (Check Item etc)
}
//Type (Check Item etc)
if (step.Type == StepType.Dialogue)
{
VisualElement itemValidateVE = stepVE.Q<VisualElement>("item-validate");

}
private void LoadAndInitOptionsDialogueLineUXML(DialogueDataSO completeDialogue, DialogueDataSO incompleteDialogue, VisualElement parent)
{
// Import UXML
{
// Import UXML
VisualElement dialogueVE = dialogueVisualTree.CloneTree();
// Set line
VisualElement dialogueVE = dialogueVisualTree.CloneTree();
// Set line
Label rightLineLabel = dialogueVE.Q<Label>("right-line-label");
// leftLineLabel.text = completeDialogue.DialogueLines[0].GetLocalizedStringImmediateSafe();
// if (incompleteDialogue != null)
//rightLineLabel.text = incompleteDialogue.DialogueLines[0].GetLocalizedStringImmediateSafe();
// hide options
Label rightLineLabel = dialogueVE.Q<Label>("right-line-label");
// leftLineLabel.text = completeDialogue.DialogueLines[0].GetLocalizedStringImmediateSafe();
// if (incompleteDialogue != null)
//rightLineLabel.text = incompleteDialogue.DialogueLines[0].GetLocalizedStringImmediateSafe();
// hide options
VisualElement buttonArea = dialogueVE.Q<VisualElement>("buttons");
buttonArea.style.display = DisplayStyle.None;

}
private void DisplayAllProperties(Object data, string visualElementName)
{
//Clear panel
{
//Clear panel
parentVE.Clear();
//Add new scrollview
parentVE.Clear();
//Add new scrollview
ScrollView scrollView = new ScrollView();
SerializedObject dataObject = new SerializedObject(data);

parentVE.Add(scrollView);
}
void AddQuestline()
{
//get questline id
{
//get questline id
FindAllSOByType(out QuestlineSO[] questLineSOs);
int id = questLineSOs.Length;
id++;

AssetDatabase.CreateFolder("Assets/ScriptableObjects/Quests", "Questline" + id);
AssetDatabase.CreateAsset(asset, "Assets/ScriptableObjects/Quests/Questline" + id + "/QL" + id + ".asset");
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
//refresh
AssetDatabase.SaveAssets();
//refresh
LoadAllQuestsData();
}
void RemoveQuestline()

RemoveQuest(quest);
_currentSelectedQuestLine.Quests.RemoveAt(0);
}
AssetDatabase.DeleteAsset(_currentSelectedQuestLine.GetPath());
//refresh List
AssetDatabase.DeleteAsset(_currentSelectedQuestLine.GetPath());
//refresh List
LoadAllQuestsData();

_currentSelectedQuestLine.Quests.Add(asset);
EditorUtility.SetDirty(asset);
EditorUtility.SetDirty(_currentSelectedQuestLine);
AssetDatabase.SaveAssets();
//refresh
AssetDatabase.SaveAssets();
//refresh
rootVisualElement.Q<VisualElement>("questlines-list").Q<ListView>().SetSelection(_idQuestlineSelected);
}

return;
//When removing a step, remove its references in the parent quest
return;
//When removing a step, remove its references in the parent quest
_currentSelectedQuestLine.Quests.Remove(_currentSelectedQuestLine.Quests.Find(o => o == _currentSeletedQuest));
//when removing a step remove its dialogues
_currentSelectedQuestLine.Quests.Remove(_currentSelectedQuestLine.Quests.Find(o => o == _currentSeletedQuest));
//when removing a step remove its dialogues
while (_currentSeletedQuest.Steps.Count > 0)
{
StepSO step = _currentSeletedQuest.Steps[0];

AssetDatabase.DeleteAsset(_currentSeletedQuest.GetPath());
_idQuestSelected = -1;
//refresh List
_idQuestSelected = -1;
//refresh List
rootVisualElement.Q<VisualElement>("questlines-list").Q<ListView>().SetSelection(_idQuestlineSelected);
}

return;
//when removing a step remove its dialogues
return;
//when removing a step remove its dialogues
{
//When removing a step, remove its references in the parent quest
{
//When removing a step, remove its references in the parent quest
RemoveStep(step);
}

_currentSeletedQuest.Steps.Add(asset);
EditorUtility.SetDirty(asset);
EditorUtility.SetDirty(_currentSeletedQuest);
AssetDatabase.SaveAssets();
//refresh
AssetDatabase.SaveAssets();
//refresh
rootVisualElement.Q<VisualElement>("quests-list").Q<ListView>().SetSelection(_idQuestSelected);

if (_currentSelectedStep == null)
return;
//When removing a step, remove its references in the parent quest
return;
//When removing a step, remove its references in the parent quest
_currentSeletedQuest.Steps.Remove(_currentSeletedQuest.Steps.Find(o => o == _currentSelectedStep));
//when removing a step remove its dialogues
_currentSeletedQuest.Steps.Remove(_currentSeletedQuest.Steps.Find(o => o == _currentSelectedStep));
//when removing a step remove its dialogues
if (_currentSelectedStep.DialogueBeforeStep != null)
{
RemoveDialogue(_currentSelectedStep.DialogueBeforeStep);

RemoveDialogue(_currentSelectedStep.IncompleteDialogue);
}
AssetDatabase.DeleteAsset(_currentSelectedStep.GetPath());
_idStepSelected = -1;
//refresh List
_idStepSelected = -1;
//refresh List
return;
//when removing a step remove its dialogues
return;
//when removing a step remove its dialogues
if (stepToRemove.DialogueBeforeStep != null)
{
RemoveDialogue(stepToRemove.DialogueBeforeStep);

AssetDatabase.DeleteAsset(stepToRemove.GetPath());
}
void RemoveDialogue(DialogueDataSO dialogueToRemove)
{
// dialogueToRemove.RemoveLineFromSharedTable();
{
// dialogueToRemove.RemoveLineFromSharedTable();
AssetDatabase.DeleteAsset(dialogueToRemove.GetPath());
}

dialoguePreviewVE.name = "Dialogue";
dialoguePreviewVE.name = "Dialogue";
/*foreach (LocalizedString localizedString in dialogueDataSO.DialogueLines)
{
Label dialogueLine = new Label();

choicesVE.Add(choiceVE);
}
dialoguePreviewVE.Add(choicesVE);
}*/
}*/
return dialoguePreviewVE;
}
正在加载...
取消
保存