private static void CallPanel() { int currentPanel = GameManager.instance.inventoryFSM.FsmVariables.FindFsmInt("Current Pane Num").Value; if (CustomPanelReceivers.TryGetValue(currentPanel, out InventoryPanel panel)) { switch (OpenMethod) { case "Open": panel.SetSelected(panel.FromOpen()); break; case "Right": panel.SetSelected(panel.FromLeft()); break; case "Left": panel.SetSelected(panel.FromRight()); break; } } }
internal static void AddInventoryPanel(InventoryPanel type) { if (!initiated) { Init(); } GameObject go = new GameObject("Inventory Panel " + Panels + type.GetType().Name); AddInventoryPanel(go); GameObject cursor = GameObject.Instantiate(GameManager.instance.inventoryFSM.transform.Find("Inv").Find("Cursor").gameObject); PlayMakerFSM cursorFSM = cursor.LocateMyFSM("Cursor Movement"); MethodBehaviour methods = go.AddComponent <MethodBehaviour>(); methods.OnEnableMethod = _ => type.OnEnable(); methods.OnDisableMethod = _ => type.OnDisable(); methods.UpdateMethod = _ => type.OnUpdate(); cursorFSM.InsertMethod("Move", 18, type.SetCursorOffsets); type.cursorFSM = cursorFSM; type.go = go; go.SetActive(false); CustomPanelReceivers.Add(Panels - 1, type); }