public void SetUpDefCoteActions(Dictionary <string, Action> actions) { GameObject Def_Cote_Panel = GameObject.Find(IUILittoSim.DEF_COTE_PANEL); foreach (KeyValuePair <string, Action> act in actions) { GameObject action_button = Instantiate(GameObject.Find(ILittoSimConcept.LITTOSIM_MANANGER).GetComponent <LittosimManager>().ButtonActionPrefab); action_button.name = "Def_Cote_" + act.Key; Vector3 position = IActionButton.GetPosition(act.Value.def_cote_index); action_button.GetComponent <Button_Action_Prefab>().SetUp("Def_Cote_" + act.Key, act.Value.def_cote_index, act.Value.button_help_message, act.Value.button_icon_file, "Def_Cote", IActionButton.GetPosition(act.Value.def_cote_index)); action_button.transform.SetParent(Def_Cote_Panel.transform); } }
public void AddCommunButtons() { GameObject Ua_Panel = GameObject.Find(IUILittoSim.UA_PANEL); GameObject Def_Cote_Panel = GameObject.Find(IUILittoSim.DEF_COTE_PANEL); Action act = null; int nbrAct = communActions.Count; foreach (string action in communActions) { actions_dic.TryGetValue(action, out act); if (act != null) { GameObject action_button = Instantiate(GameObject.Find(ILittoSimConcept.LITTOSIM_MANANGER).GetComponent <LittosimManager>().ButtonActionPrefab); action_button.name = "Land_Use_" + action; action_button.GetComponent <RectTransform>().SetParent(Ua_Panel.GetComponent <RectTransform>()); action_button.GetComponent <Button_Action_Prefab>().SetUp("Land_Use_" + action, act.action_code, act.button_help_message, act.button_icon_file, "Land_Use", IActionButton.GetPosition(13 - nbrAct)); action_button.tag = ILittoSimConcept.LAND_USE_COMMON_BUTTON_TAG; action_button = Instantiate(GameObject.Find(ILittoSimConcept.LITTOSIM_MANANGER).GetComponent <LittosimManager>().ButtonActionPrefab); action_button.name = "Coastal_Defense_" + action; action_button.GetComponent <RectTransform>().SetParent(Def_Cote_Panel.GetComponent <RectTransform>()); action_button.GetComponent <Button_Action_Prefab>().SetUp("Coastal_Defense_" + action, act.action_code, act.button_help_message, act.button_icon_file, "Coastal_Defense", IActionButton.GetPosition(13 - nbrAct)); action_button.tag = ILittoSimConcept.COASTAL_DEFENSE_COMMON_BUTTON_TAG; nbrAct--; } } GameObject.Find("Land_Use_ACTION_DISPLAY_FLOODED_AREA").GetComponent <Button_Action_Prefab>().OnOffButton = true; GameObject.Find("Land_Use_ACTION_DISPLAY_PROTECTED_AREA").GetComponent <Button_Action_Prefab>().OnOffButton = true; GameObject.Find("Land_Use_ACTION_DISPLAY_FLOODED_AREA").GetComponent <Button_Action_Prefab>().species = IUILittoSim.FLOOD_RISK_AREA; GameObject.Find("Land_Use_ACTION_DISPLAY_PROTECTED_AREA").GetComponent <Button_Action_Prefab>().species = IUILittoSim.PROTECTED_AREA; // GameObject.Find("Coastal_Defense_ACTION_DISPLAY_FLOODED_AREA").GetComponent<Button_Action_Prefab>().OnOffButton = true; // GameObject.Find("Coastal_Defense_DISPLAY_PROTECTED_AREA").GetComponent<Button_Action_Prefab>().OnOffButton = true; // GameObject.Find("Coastal_Defense_DISPLAY_FLOODED_AREA").GetComponent<Button_Action_Prefab>().species = IUILittoSim.FLOOD_RISK_AREA; // GameObject.Find("Coastal_Defense_DISPLAY_PROTECTED_AREA").GetComponent<Button_Action_Prefab>().species = IUILittoSim.PROTECTED_AREA; }
public void SetUpUAActions(Dictionary <string, Action> actions) { GameObject Ua_Panel = GameObject.Find(IUILittoSim.UA_PANEL); //Text BTest = GameObject.Find("BTest").GetComponent<Text>(); //BTest.text = " -> Here is the script to fix buttons issue"; foreach (KeyValuePair <string, Action> act in actions) { GameObject action_button = Instantiate(GameObject.Find(ILittoSimConcept.LITTOSIM_MANANGER).GetComponent <LittosimManager>().ButtonActionPrefab); action_button.name = "Land_Use_" + act.Key; action_button.GetComponent <RectTransform>().SetParent(Ua_Panel.GetComponent <RectTransform>()); action_button.GetComponent <Button_Action_Prefab>().SetUp("Land_Use_" + act.Key, act.Value.action_code, act.Value.button_help_message, act.Value.button_icon_file, "Land_Use", IActionButton.GetPosition(act.Value.lu_index)); } }