상속: System.EventArgs
            protected void RegisterAction(JSONObject action, string id)
            {
                object typeObj, valueObj;

                action.TryGetValue("value", out valueObj);

                if (action.TryGetValue("type", out typeObj))
                {
                    ImageMessage.EventArgs eventArgs = new ImageMessage.EventArgs(id, (string)typeObj, (string)valueObj);

                    switch ((string)typeObj)
                    {
                    case "none": {
                        actions.Add(() => {});
                        break;
                    }

                    case "action": {
                        actions.Add(() => {
                                if (valueObj != null)
                                {
                                    if (imageMessage.OnAction != null)
                                    {
                                        imageMessage.OnAction(eventArgs);
                                    }
                                }
                                imageMessage.Close();
                            });
                        break;
                    }

                    case "link": {
                        actions.Add(() => {
                                if (imageMessage.OnAction != null)
                                {
                                    imageMessage.OnAction(eventArgs);
                                }
                                if (valueObj != null)
                                {
                                    Application.OpenURL((string)valueObj);
                                }
                                imageMessage.Close();
                            });
                        break;
                    }

                    default: {      // "dismiss"
                        actions.Add(() => {
                                if (imageMessage.OnDismiss != null)
                                {
                                    imageMessage.OnDismiss(eventArgs);
                                }
                                imageMessage.Close();
                            });
                        break;
                    }
                    }
                }
            }
예제 #2
0
        public void EventArgsStoreIdAndTypeAndValue()
        {
            var uut = new ImageMessage.EventArgs("id", "type", "value");

            Expect(uut.ID, Is.EqualTo("id"));
            Expect(uut.ActionType, Is.EqualTo("type"));
            Expect(uut.ActionValue, Is.EqualTo("value"));
        }
예제 #3
0
            protected void RegisterAction(JSONObject action, string id)
            {
                object typeObj, valueObj;
                action.TryGetValue("value", out valueObj);

                if (action.TryGetValue("type", out typeObj)) {

                    ImageMessage.EventArgs eventArgs = new ImageMessage.EventArgs(id, (string)typeObj, (string)valueObj);

                    switch ((string)typeObj) {
                        case "none": {
                            actions.Add(() => {});
                            break;
                        }
                        case "action": {
                            actions.Add(() => {
                                if (valueObj != null) {
                                    if (imageMessage.OnAction != null) {
                                        imageMessage.OnAction(eventArgs);
                                    }
                                }
                                imageMessage.Close();
                            });
                            break;
                        }
                        case "link": {
                            actions.Add(() => {
                                if (imageMessage.OnAction != null) {
                                    imageMessage.OnAction(eventArgs);
                                }
                                if (valueObj != null) {
                                    Application.OpenURL((string)valueObj);
                                }
                                imageMessage.Close();
                            });
                            break;
                        }
                        default : { // "dismiss"
                            actions.Add(() => {
                                if (imageMessage.OnDismiss != null) {
                                    imageMessage.OnDismiss(eventArgs);
                                }
                                imageMessage.Close();
                            });
                            break;
                        }
                    }
                }
            }
예제 #4
0
            protected void RegisterAction(JSONObject action, string id)
            {
                object typeObj, valueObj;

                action.TryGetValue("value", out valueObj);

                if (action.TryGetValue("type", out typeObj))
                {
                    ImageMessage.EventArgs eventArgs = new ImageMessage.EventArgs(id, (string)typeObj, (string)valueObj);

                    GameEvent actionEvent = new GameEvent("imageMessageAction");
                    if (imageMessage.engagement.JSON.ContainsKey("eventParams"))
                    {
                        var eventParams = imageMessage.engagement.JSON["eventParams"] as Dictionary <string, object>;
                        actionEvent.AddParam("responseDecisionpointName", eventParams["responseDecisionpointName"]);
                        actionEvent.AddParam("responseEngagementID", eventParams["responseEngagementID"]);
                        actionEvent.AddParam("responseEngagementName", eventParams["responseEngagementName"]);
                        actionEvent.AddParam("responseEngagementType", eventParams["responseEngagementType"]);
                        actionEvent.AddParam("responseMessageSequence", eventParams["responseMessageSequence"]);
                        actionEvent.AddParam("responseVariantName", eventParams["responseVariantName"]);
                        actionEvent.AddParam("responseTransactionID", eventParams["responseTransactionID"]);
                    }

                    actionEvent.AddParam("imActionName", id);
                    actionEvent.AddParam("imActionType", (string)typeObj);
                    if (!String.IsNullOrEmpty((string)valueObj) && (string)typeObj != "dismiss")
                    {
                        actionEvent.AddParam("imActionValue", (string)valueObj);
                    }

                    switch ((string)typeObj)
                    {
                    case "none": {
                        actions.Add(() => {});
                        break;
                    }

                    case "action": {
                        actions.Add(() => {
                                if (valueObj != null)
                                {
                                    if (imageMessage.OnAction != null)
                                    {
                                        imageMessage.OnAction(eventArgs);
                                    }
                                }
                                DDNA.Instance.RecordEvent(actionEvent);
                                imageMessage.Close();
                            });
                        break;
                    }

                    case "link": {
                        actions.Add(() => {
                                if (imageMessage.OnAction != null)
                                {
                                    imageMessage.OnAction(eventArgs);
                                }
                                if (valueObj != null)
                                {
                                    Application.OpenURL((string)valueObj);
                                }
                                DDNA.Instance.RecordEvent(actionEvent);
                                imageMessage.Close();
                            });
                        break;
                    }

                    default: {      // "dismiss"
                        actions.Add(() => {
                                if (imageMessage.OnDismiss != null)
                                {
                                    imageMessage.OnDismiss(eventArgs);
                                }
                                DDNA.Instance.RecordEvent(actionEvent);
                                imageMessage.Close();
                            });
                        break;
                    }
                    }
                }
            }