Ability to choose client directory.
This commit is contained in:
parent
2ec1d538be
commit
a32366b8c8
@ -35,11 +35,7 @@ bool FiestaOnlineEditor::OnUserCreate(){
|
|||||||
selectedPath.push_back("");
|
selectedPath.push_back("");
|
||||||
|
|
||||||
utils::datafile::Read(config,"assets/program.txt");
|
utils::datafile::Read(config,"assets/program.txt");
|
||||||
if(config.HasProperty("DefaultPath")){
|
InitializePathSelection();
|
||||||
manager.Open(&menu);
|
|
||||||
} else {
|
|
||||||
manager.Open(&dialog.GetMenu());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -105,12 +101,15 @@ bool FiestaOnlineEditor::OnUserUpdate(float fElapsedTime){
|
|||||||
}break;
|
}break;
|
||||||
case SELECTED_FOLDER:{
|
case SELECTED_FOLDER:{
|
||||||
std::cout<<selectedPath.back()<<std::endl;
|
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");
|
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();
|
manager.Close();
|
||||||
|
InitializePathSelection();
|
||||||
}break;
|
}break;
|
||||||
case LOAD_ITEM_EDITOR:{
|
case LOAD_ITEM_EDITOR:{
|
||||||
ItemEditor*itemEditor=new ItemEditor(this,"Item Editor: "+config["DefaultPath"].GetString(),{32,32},GetScreenSize()-vi2d{64,64});
|
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);
|
SetDrawTarget(1);
|
||||||
//BACKGROUND DRAWING
|
//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;
|
bool internalMouseFocus=false;
|
||||||
for(Window*w:windows){
|
for(Window*w:windows){
|
||||||
if(!w->IsFocusedWindow()){
|
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.
|
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()
|
int main()
|
||||||
{
|
{
|
||||||
FiestaOnlineEditor demo;
|
FiestaOnlineEditor demo;
|
||||||
|
@ -19,6 +19,7 @@ class FiestaOnlineEditor : public olc::PixelGameEngine
|
|||||||
utils::datafile config;
|
utils::datafile config;
|
||||||
std::vector<Window*>windows;
|
std::vector<Window*>windows;
|
||||||
bool menuOpened=false;
|
bool menuOpened=false;
|
||||||
|
PickState pickFileState=SHINEDIR;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FiestaOnlineEditor();
|
FiestaOnlineEditor();
|
||||||
@ -29,4 +30,5 @@ public:
|
|||||||
bool OnUserUpdate(float fElapsedTime) override;
|
bool OnUserUpdate(float fElapsedTime) override;
|
||||||
#undef CreateWindow //Stupid Windows
|
#undef CreateWindow //Stupid Windows
|
||||||
void CreateWindow(Window*window);
|
void CreateWindow(Window*window);
|
||||||
|
void InitializePathSelection();
|
||||||
};
|
};
|
@ -1,8 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
enum State{
|
enum State{
|
||||||
LOADFOLDER,
|
LOADFOLDER,
|
||||||
|
MENUSELECT,
|
||||||
ITEMEDIT,
|
ITEMEDIT,
|
||||||
MOBEDIT,
|
MOBEDIT,
|
||||||
QUESTEDIT,
|
QUESTEDIT,
|
||||||
|
};
|
||||||
|
enum PickState{
|
||||||
|
SHINEDIR,
|
||||||
|
CLIENTDIR,
|
||||||
};
|
};
|
@ -1 +1,2 @@
|
|||||||
DefaultPath = /Users/sigon/Documents/NA2016-main/Server/9Data/Shine
|
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