From 0a7a4977e3adc29f806e9e61e5e9b35b3cd22c5e Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Sat, 11 Sep 2021 18:12:58 +0900 Subject: [PATCH] Confirm and cancel button implementations completed. --- src/TestPanel.js | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/TestPanel.js b/src/TestPanel.js index 1951e94..a7905f6 100644 --- a/src/TestPanel.js +++ b/src/TestPanel.js @@ -389,7 +389,18 @@ function FoodPopupWindow(p) { } } - return
Foods in Recipe
{FOODCOUNT}
Confirm
Cancel
} + return +
+
Foods in Recipe
+
{FOODCOUNT}
+
+
+
{p.setFoodMenuWindowOpen(false)}}>Confirm
+
{p.setFoodMenuWindowOpen(false);p.setFoodPointData(p.prevFoodPointData)}}>Cancel
+
+ } sortItems={["Standard Sort","Alphabetical","Food Name","Food Type","Popularity"]} filter={true} dataFunction={()=>{ @@ -460,6 +471,7 @@ const [classNameSetter,setClassNameSetter] = useState(0) const [points,setPoints] = useState([]) const [skillPointData,setSkillPointData] = useState([]) const [prevSkillPointData,setPrevSkillPointData] = useState([]) +const [prevPoints,setPrevPoints] = useState([]) const [foodPointData,setFoodPointData] = useState({}) const [prevFoodPointData,setPrevFoodPointData] = useState({}) @@ -468,13 +480,13 @@ const [BUFFS,setBUFFS] = useState({}) function CalculateBuffs(foodPointData) { - var boost_prefixes = { + const boost_prefixes = { pp_consumption:"Rich", pp_recovery:"Light", weak_point_dmg:"Crisp", hp_recovery:"Robust", } - var boost_suffixes = { + const boost_suffixes = { potency:"Meat", pp:"Fruit", dmg_res:"Vegetable", @@ -605,11 +617,19 @@ useEffect(()=>{ },[foodPointData]) useEffect(()=>{ - console.log(BUFFS) -},[BUFFS]) + console.log(prevSkillPointData) +},[prevSkillPointData]) //console.log(p.GetData("class",p.className,"icon")) +function deepCopySkills(skillData) { + var newSkillObj = [] + for (var data of skillData) { + newSkillObj.push({...data}) + } + return newSkillObj +} + return (<> @@ -627,7 +647,7 @@ useEffect(()=>{
Author
Build Name
{setClassSelectWindowOpen(true)}}>Class
-
{setClassSkillTreeWindowOpen(true)}}>Sub-Class
+
{setPrevPoints([...points]);setPrevSkillPointData(deepCopySkills(skillPointData));setClassSkillTreeWindowOpen(true)}}>Sub-Class
@@ -817,7 +837,7 @@ useEffect(()=>{

Current Effects

- {effectPage===1?<>

Effect Name

  • {setFoodMenuWindowOpen(true)}}>Food Boost Effect + {effectPage===1?<>

    Effect Name

    • {setPrevFoodPointData({...foodPointData});setFoodMenuWindowOpen(true)}}>Food Boost Effect
        {Object.keys(BUFFS).length==0&&
      • Add Quick Food
      • } {Object.keys(BUFFS).map((key)=>
      •  [{BUFFS[key].from}] {key} +{BUFFS[key].count}
      • )} @@ -905,7 +925,7 @@ useEffect(()=>{
        Your Skill Points{20-points[treePage-1]}
        SP{points[treePage-1]}
        -
        Confirm
        Cancel
        +
        {setClassSkillTreeWindowOpen(false)}} className="skillConfirm">
        Confirm
        {setPoints(prevPoints);setSkillPointData(prevSkillPointData);setClassSkillTreeWindowOpen(false)}}>Cancel
        @@ -1000,7 +1020,8 @@ useEffect(()=>{ foodMenuWindowOpen={foodMenuWindowOpen} setFoodMenuWindowOpen={setFoodMenuWindowOpen} foodPointData={foodPointData} - setFoodPointData={setFoodPointData}/> + setFoodPointData={setFoodPointData} + prevFoodPointData={prevFoodPointData}/> {setAugmentSelectWindowOpen(false)}} shouldFocusAfterRender={true} shouldCloseOnOverlayClick={true} shouldCloseOnEsc={true} className="modal" overlayClassName="modalOverlay">