示例#1
0
    // Use this for initialization
    void Start()
    {
        e  = new Event();
        eS = new EventString();
        e.Listen(NormalEvent);
        eS.Listen(StringEvent);

        //Events need function call to invoke
        e.Trigger();
        eS.Trigger("EVENT RIGGERED!");

        //Delegates
        del          += NormalEvent;
        delString    += StringEvent;
        delReturnInt += EventReturnValue;

        //Delegates can directly call itself as a function for invocation
        del();
        delString("DELEGATE TRIGGERED!");
        Debug.Log("EVENT RETURN VALUE " + delReturnInt());

        action       += NormalEvent;
        actionString += StringEvent;

        //Action can directly call itself as a function for invocation
        action();
        actionString("ACTION TRIGGERED!");
    }
        protected override bool Execute(CodeActivityContext context)
        {
            //Login не возвращает ID пока пишем в user_ID логин и ставим галку
            string user_ID    = User_ID.Get(context);
            string eventSting = EventString.Get(context);

            byte   applicationType  = ApplicationType.Get(context);
            string commentString    = CommentString.Get(context);
            string parentObjectID   = ParentObjectID.Get(context);
            string parentObjectName = ParentObjectName.Get(context);
            string objectID         = ObjectID.Get(context);
            string bjectName        = ObjectName.Get(context);
            byte   eventType        = EventType.Get(context);

            try
            {
                DeclaratorService.Insert_ExplUserJournal(user_ID, eventSting, commentString, applicationType, 0, eventType, bjectName, objectID, parentObjectName, parentObjectID,
                                                         true);
            }
            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
            }


            return(string.IsNullOrEmpty(Error.Get(context)));
        }
示例#3
0
        public void getEvent(Object sender, EventString e)
        {
            Debug.WriteLine(e.JsonString);
            dynamic jsonResult = JsonConvert.DeserializeObject(e.JsonString);

            int    action = jsonResult.Action;
            string id     = jsonResult.Id;

            Character character;

            switch (action)
            {
            case 1:                     // someone connect from mobile apk
                                        // TODO: powiadomienie że ktoś się połączył
                ;
                break;

            case 2:                     // someone create new character
                                        // TODO: niezabezpieczone jak null albo zerwie połaczenie
                character = _get_character_from_url(url + apiGetCharacter + "/" + jsonResult.CharacterId.ToString());
                if (character != null)
                {
                    AddNewWidget(character);
                }
                break;

            case 3:                     // someone update charater
                                        // TODO: niezabezpieczone jak null albo zerwie połaczenie
                character = _get_character_from_url(url + apiGetCharacter + "/" + jsonResult.CharacterId.ToString());
                if (character != null)
                {
                    UpdateWidget(character);
                }
                break;

            case 4:                     // dice roll
                ;
                break;

            case 5:                     // message
                ;
                break;

            case 6:                     // avatar img
                ;
                break;
            }
        }