private void PopupEvent(CGM.CGMObject source) { //CGME.Resource[] cgme_resources = source.GetCGMEResources(); CGM.Resource[] resources = GetResourcesFrom(source); CGME.Actor source_actor = source.GetCGMEActor(); List <CGME.ResourceAction> res_actions = new List <CGME.ResourceAction>(); foreach (Resource res in resources) { if (res.CGME_Resource is CGME.ResourceAction && (res.CGME_Resource as CGME.ResourceAction).IsAvailable(CGME_Manager.Running_phase.Index) && (!res.RestrictParent || (source_actor.Parent != null && res.ParentType == source_actor.Parent.CGType))) { res_actions.Add(res.CGME_Resource as CGME.ResourceAction); } } if (res_actions.Count <= 0) { Debug.Log("No action resources available"); return; } DrawPopup(source, Input.mousePosition, res_actions.ToArray()); }
protected virtual void OnEnable() { Target = (CGM.CGMObject)target; resources = Target.GetChildrenResources(); //library = FindObjectOfType<CGM.Library>(); }
public override void DrawObject(CGM.CGMObject Target) { CGM.Deck t = (CGM.Deck)target; t.CGME_Deck.CGType = EditorGUILayout.TextField("Type", t.CGME_Deck.CGType); Target.gameObject.name = t.CGME_Deck.CGType; t.visible_children = EditorGUILayout.Toggle("Deck View - visible children", t.visible_children); t.deny_reposition = EditorGUILayout.Toggle("Deck View - deny reposition", t.deny_reposition); t.pile = EditorGUILayout.Toggle("Deck View - pile format", t.pile); if (!t.pile) { t.size = EditorGUILayout.FloatField("Deck View - width", t.size); t.spread = EditorGUILayout.FloatField("Deck View - spread", t.spread); } }
public override void DrawObject(CGM.CGMObject Target) { phase_target.CGME_Phase.CGType = EditorGUILayout.TextField("Type", phase_target.CGME_Phase.CGType); Target.gameObject.name = phase_target.CGME_Phase.CGType; EditorGUILayout.LabelField("Actions"); CGM.Phase p = (CGM.Phase)Target; if (GUILayout.Button("Add Action")) { p.action_sequence.Add(0); } for (int i = 0; i < phase_target.action_sequence.Count; i++) { p.action_sequence[i] = EditorGUILayout.Popup(p.action_sequence[i], action_names); } }
private void StandardEvent(InterfaceEvent ev, CGM.CGMObject source) { CGM.Resource[] resources = GetResourcesFrom(source); CGME.Actor source_actor = source.GetCGMEActor(); if (resources == null) { return; } foreach (CGM.Resource res in resources) { if (res.Trigger == ev && res.CGME_Resource is CGME.ResourceAction && (!res.RestrictParent || (source_actor.Parent != null && res.ParentType == source_actor.Parent.CGType))) { RunAction(res.CGME_Resource as CGME.ResourceAction, source_actor); } } }
public void ReportEvent(InterfaceEvent ev, CGM.CGMObject source) { if (popup_window != null) { return; } //Debug.Log (ev); if (ev == InterfaceEvent.PopUp) { PopupEvent(source); return; } if (ev == InterfaceEvent.Any || ev == InterfaceEvent.MouseOver || (ev == InterfaceEvent.Click)) { //Debug.Log (ev); StandardEvent(ev, source); return; } }
public override void DrawObject(CGM.CGMObject Target) { CGM.Button button_target = (CGM.Button)Target; button_target.name = EditorGUILayout.TextField("Name", button_target.name); }
public override void DrawObject(CGM.CGMObject Target) { CGM.Card card_target = (CGM.Card)target; card_target.CGME_Card.CGType = EditorGUILayout.TextField("Type", card_target.CGME_Card.CGType); Target.gameObject.name = card_target.CGME_Card.CGType; }
// public override void OnInspectorGUI() // { // CGMEU.Card Target = (CGMEU.Card)target; // // Target.name = EditorGUILayout.TextField("Name", Target.name); // EditorGUILayout.LabelField("Resources"); // foreach (CGMEU.Resource res in Target.Resources){ // EditorGUILayout.BeginHorizontal(); // res.name = EditorGUILayout.TextField(res.name); // // if (res.Resource_type == CGMEU.ResourceType.Number){ // CGME.ResourceNumber cgres = (CGME.ResourceNumber)res.CGME_Resource; // cgres.Value = EditorGUILayout.IntField (cgres.Value); // } // else if (res.Resource_type == CGMEU.ResourceType.Text){ // CGME.ResourceText cgres = (CGME.ResourceText)res.CGME_Resource; // cgres.Value = EditorGUILayout.TextField (cgres.Value); // } // else if (res.Resource_type == CGMEU.ResourceType.Bool){ // CGME.ResourceBool cgres = (CGME.ResourceBool)res.CGME_Resource; // cgres.Value = EditorGUILayout.Toggle (cgres.Value); // } // else if (res.Resource_type == CGMEU.ResourceType.Action){ // CGME.ResourceAction cgres = (CGME.ResourceAction)res.CGME_Resource; // //cgres.Value = EditorGUILayout.TextArea.Field (cgres.Value); // EditorGUILayout.LabelField (cgres.Value.Name); // } // // // EditorGUILayout.EndHorizontal(); // } // // // //EditorGUILayout.LabelField("Level", myTarget.Level.ToString()); // } public override void DrawObject(CGM.CGMObject Target) { CGM.Player t = (CGM.Player)target; t.CGME_Player.CGType = EditorGUILayout.TextField("Type", t.CGME_Player.CGType); Target.gameObject.name = t.CGME_Player.CGType; }
public virtual void DrawObject(CGM.CGMObject Target) { return; }