diff --git a/src/App.js b/src/App.js index b4b169a..45b1a24 100644 --- a/src/App.js +++ b/src/App.js @@ -357,6 +357,8 @@ function AdminPanel(p) { {page:"Skills",url:"/admin/skills",table:"/skill"}, {page:"Skill Types",url:"/admin/skilltypes",table:"/skill_type"}, {page:"Skill Data",url:"/admin/skilldata",table:"/skill_data"}, + {page:Skill Tree Editor,url:"/admin/skilltreeeditor",render:}, + {page:"Skill Tree Data",url:"/admin/skilltreedata",table:"/skill_tree_data"}, {page:"Photon Arts",url:"/admin/photonarts",table:"/photon_art",duplicate:true}, {page:"Class Skills",url:"/admin/classskills",table:"/class_skill",duplicate:true}, {page:"Class Skill Data",url:"/admin/classskilldata",table:"/class_skill_data",duplicate:true}, @@ -395,22 +397,24 @@ function AdminPanel(p) { })}}}> :<> -
Testing Mode {p.setTESTMODE(f.target.checked)}}/> {p.TESTMODE?ON:OFF}
+
Testing Mode {p.setTESTMODE(f.target.checked)}}/> {p.TESTMODE?ON:OFF}
{navigationData.map((nav)=>(nav.hr)?
:<>{nav.page}
)} Database Manager
-
+
{navigationData.map((nav)=>(nav.duplicate===undefined&&nav.hr===undefined)&& + {APP_TITLE+" - Admin Panel: "+nav.page} -

{nav.page}

- -
)} + {nav.render??} + )} - + + +
} diff --git a/src/skilltree/skillTreeEditor.js b/src/skilltree/skillTreeEditor.js index 9fdd25e..48bc57e 100644 --- a/src/skilltree/skillTreeEditor.js +++ b/src/skilltree/skillTreeEditor.js @@ -7,7 +7,8 @@ function SkillTreeEditor(p) { const ADJUSTMENT = [-32,-32] - const [classList,setClassList] = useState([]) + const [classList,setClassList] = useState({}) + const [skillTreeData,setSkillTreeData] = useState({}) const [cl,setCl] = useState(0) const [lineColor,setLineColor] = useState("#000000") const [lineWidth,setLineWidth] = useState(3) @@ -18,18 +19,27 @@ function SkillTreeEditor(p) { const [gridPaddingX,setGridPaddingX] = useState(10) const [gridPaddingY,setGridPaddingY] = useState(10) const [renderedInputs,setRenderedInputs] = useState([]) - const [skillLines,setSkillLines] = useState([ - "□ □ ", //─ □ - "└□─┘□□", //│ ├┤┼ - " │ ││", // - " │ □│", //┌ ┐ ┬ - " □─□┼□", //└ ┘ ┴ - " □ "]) + const [skillLines,setSkillLines] = useState([]) useEffect(()=>{ setClassList(p.GetData("class",undefined,undefined,true)) + setSkillTreeData(p.GetData("skill_tree_data",undefined,undefined,true)) },[p.GetData]) + useEffect(()=>{ + var keys = Object.keys(skillTreeData) + for (var id of keys) { + //console.log(cl+"/"+skillTreeData[id].class_id) + if (skillTreeData[id].class_id==cl) { + var data = skillTreeData[id].data.split(',') + setSkillLines(data) + setDimensionX(data[0].length) + setDimensionY(data.length) + setLineColor(skillTreeData[id].line_color) + } + } + },[skillTreeData,cl]) + useEffect(()=>{ setCl(Object.keys(classList)[0]) },[classList]) @@ -69,15 +79,15 @@ function SkillTreeEditor(p) { },[skillLines,gridSizeX,gridSizeY,gridPaddingX,gridPaddingY,cl]) return <> +
{renderedInputs.map((control)=>control)} - {setLineColor(f.currentTarget.value)}}/> {setLineWidth(f.currentTarget.value)}}/> {setDimensionX(f.currentTarget.value)}}/>