Ability to choose client directory.
This commit is contained in:
parent
2ec1d538be
commit
a32366b8c8
@ -35,11 +35,7 @@ bool FiestaOnlineEditor::OnUserCreate(){
|
||||
selectedPath.push_back("");
|
||||
|
||||
utils::datafile::Read(config,"assets/program.txt");
|
||||
if(config.HasProperty("DefaultPath")){
|
||||
manager.Open(&menu);
|
||||
} else {
|
||||
manager.Open(&dialog.GetMenu());
|
||||
}
|
||||
InitializePathSelection();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -105,12 +101,15 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
|
||||
}break;
|
||||
case SELECTED_FOLDER:{
|
||||
std::cout<<selectedPath.back()<<std::endl;
|
||||
config["DefaultPath"].SetString(selectedPath.back());
|
||||
if(pickFileState==SHINEDIR){
|
||||
config["DefaultPath"].SetString(selectedPath.back());
|
||||
} else
|
||||
if(pickFileState==CLIENTDIR){
|
||||
config["ClientPath"].SetString(selectedPath.back());
|
||||
}
|
||||
utils::datafile::Write(config,"assets/program.txt");
|
||||
ItemEditor*itemEditor=new ItemEditor(this,"Item Editor: "+selectedPath.back(),{32,32},GetScreenSize()-vi2d{64,64});
|
||||
CreateWindow(itemEditor);
|
||||
itemEditor->Load(selectedPath.back());
|
||||
manager.Close();
|
||||
InitializePathSelection();
|
||||
}break;
|
||||
case LOAD_ITEM_EDITOR:{
|
||||
ItemEditor*itemEditor=new ItemEditor(this,"Item Editor: "+config["DefaultPath"].GetString(),{32,32},GetScreenSize()-vi2d{64,64});
|
||||
@ -140,6 +139,17 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
|
||||
SetDrawTarget(1);
|
||||
//BACKGROUND DRAWING
|
||||
|
||||
if(appState==LOADFOLDER){
|
||||
switch(pickFileState){
|
||||
case SHINEDIR:{
|
||||
DrawString({2,2},"Choose the Shine file directory:");
|
||||
}break;
|
||||
case CLIENTDIR:{
|
||||
DrawString({2,2},"Choose the Client file directory:");
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
bool internalMouseFocus=false;
|
||||
for(Window*w:windows){
|
||||
if(!w->IsFocusedWindow()){
|
||||
@ -219,6 +229,21 @@ void FiestaOnlineEditor::CreateWindow(Window*window){
|
||||
windows.reserve(windows.size()+1);//HACK ALERT! Whenever we are iterating through the windows list we could potentially add an item to the end of it whenever it becomes focused to keep layering. Because of this we don't want to reallocate during another push_back. This ensures that will never occur.
|
||||
}
|
||||
|
||||
void FiestaOnlineEditor::InitializePathSelection(){
|
||||
if(config.HasProperty("DefaultPath")&&config.HasProperty("ClientPath")){
|
||||
appState=MENUSELECT;
|
||||
manager.Open(&menu);
|
||||
} else
|
||||
if(!config.HasProperty("DefaultPath")){
|
||||
pickFileState=SHINEDIR;
|
||||
manager.Open(&dialog.GetMenu());
|
||||
} else
|
||||
if(!config.HasProperty("ClientPath")){
|
||||
pickFileState=CLIENTDIR;
|
||||
manager.Open(&dialog.GetMenu());
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
FiestaOnlineEditor demo;
|
||||
|
@ -19,6 +19,7 @@ class FiestaOnlineEditor : public olc::PixelGameEngine
|
||||
utils::datafile config;
|
||||
std::vector<Window*>windows;
|
||||
bool menuOpened=false;
|
||||
PickState pickFileState=SHINEDIR;
|
||||
|
||||
public:
|
||||
FiestaOnlineEditor();
|
||||
@ -29,4 +30,5 @@ public:
|
||||
bool OnUserUpdate(float fElapsedTime) override;
|
||||
#undef CreateWindow //Stupid Windows
|
||||
void CreateWindow(Window*window);
|
||||
void InitializePathSelection();
|
||||
};
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
enum State{
|
||||
LOADFOLDER,
|
||||
MENUSELECT,
|
||||
ITEMEDIT,
|
||||
MOBEDIT,
|
||||
QUESTEDIT,
|
||||
|
||||
};
|
||||
enum PickState{
|
||||
SHINEDIR,
|
||||
CLIENTDIR,
|
||||
};
|
@ -1 +1,2 @@
|
||||
DefaultPath = /Users/sigon/Documents/NA2016-main/Server/9Data/Shine
|
||||
ClientPath = /Users/sigon/Documents/NA2016-main/Client
|
||||
|
Loading…
x
Reference in New Issue
Block a user