Exemplo n.º 1
0
    // 플로어 이동 이벤트가 시작되었을 때 호출된다.
    public void             onBeginTransportEvent()
    {
        TransportEvent ev = EventRoot.get().getCurrentEvent <TransportEvent>();

        this.door_position = ev.getDoor().getPosition();
        this.is_in_event   = true;
    }
        public void Write(EventRoot @event)
        {
            try
            {
                using (_sessionChannel)
                {
                    var messageBody = Adapt(@event);

                    _sessionChannel.ExchangeDeclare(exchange: _queueSettings.QueueName, type: "direct", durable: false);
                    _sessionChannel.QueueDeclare(queue: @event.EventScope, durable: false, exclusive: false, autoDelete: false);

                    var props = _sessionChannel.CreateBasicProperties();
                    props.ContentType     = _queueSettings.ContentType;
                    props.DeliveryMode    = _queueSettings.DeliveryMode;
                    props.ContentEncoding = Encoding.UTF8.EncodingName;
                    props.Persistent      = _queueSettings.Persistent;

                    _sessionChannel.BasicPublish(exchange: _queueSettings.QueueName, routingKey: @event.EventScope, basicProperties: props, body: messageBody);
                }
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException(ex.Message);
            }
        }
        private void OnAcceptClick(object sender, EventArgs e)
        {
            EventRoot eventRoot       = EventRoot.Current;
            Item      eventItem       = eventRoot.CreateEvent(this._textBox.Text);
            string    linkForTaskPage = TaskPageUtils.GetLinkForTaskPage(eventItem);

            this.Page.Response.Redirect(linkForTaskPage, false);
        }
Exemplo n.º 4
0
 protected void RaiseEvent <TSource>(IEventOf <TSource> @event) where TSource : EventSource
 {
     if (@event == null)
     {
         throw new ArgumentNullException(nameof(@event));
     }
     EventRoot.RaiseEventOf(@event);
 }
Exemplo n.º 5
0
        public bool Execute(ScheduleRoot schedule, List <MappingFields> mapping)
        {
            EventRoot eventRoot = new EventRoot {
                Schedule = schedule.Schedule, Authentication = schedule.Authentication, MappingFields = mapping
            };

            return(Execute(eventRoot, mapping.Where(w => FilterEntity(w.Entity)).ToList()));
        }
Exemplo n.º 6
0
 public bool Execute(EventRoot eventRoot, List <MappingFields> mapping)
 {
     if (base.Execute(eventRoot))
     {
         return(SendRequestSave(eventRoot, mapping, GetResponse));
     }
     return(false);
 }
Exemplo n.º 7
0
    public static EventRoot get()
    {
        if (EventRoot.instance == null)
        {
            EventRoot.instance = GameObject.Find("EventRoot").GetComponent <EventRoot>();
        }

        return(EventRoot.instance);
    }
        private void CopyEmailTemplate(Item item)
        {
            var eventitem = new EventItem(item);

            EventRoot eventRoot = eventitem.EventRoot;

            item.Fields["EmailMessage"].Value = eventRoot.EmailMessage.Value;
            item.Fields["EmailSubject"].Value = eventRoot.EmailSubject.Value;
            item.Fields["EmailName"].Value    = eventRoot.EmailName.Value;
            item.Fields["FromEmail"].Value    = eventRoot.EmailFrom.Value;
        }
Exemplo n.º 9
0
 public IHttpActionResult GetEventNotification(EventRoot event_root)
 {
     if (event_root.payload != null)
     {
         var    currentDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
         string fileName         = [email protected];
         string path             = Path.Combine(currentDirectory, @"EventData\", fileName + ".txt");
         var    eventData        = new JavaScriptSerializer().Serialize(event_root);
         File.WriteAllText(path, eventData);
     }
     return(Ok());
 }
Exemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     this.step              = STEP.NONE; // 현 단계 상태를 초기화.
     this.next_step         = STEP.MOVE; // 다음 단계 상태를 초기화.
     this.item_root         = GameObject.Find("GameRoot").GetComponent <ItemRoot>();
     this.guistyle.fontSize = 16;
     this.guistyle.fontSize = 16;
     this.event_root        =
         GameObject.Find("GameRoot").GetComponent <EventRoot>();
     this.rocket_model = GameObject.Find("rocket").transform.Find("rocket_model").gameObject;
     this.game_status  = GameObject.Find("GameRoot").GetComponent <GameStatus>();
     animator          = this.transform.GetChild(0).GetComponent <Animator>();
 }
    public float step_timer = 0.0f;      // タイマー

    void Start()
    {
        this.step      = STEP.NONE; // 現ステップの状態を初期化
        this.next_step = STEP.MOVE; // 次ステップの状態を初期化
        this.item_root = GameObject.Find("GameRoot").GetComponent <ItemRoot>();

        this.guistyle.fontSize = 16;

        this.event_root = GameObject.Find("GameRoot").GetComponent <EventRoot>();

        this.rocket_model = GameObject.Find("rocket").transform.FindChild("rocket_model").gameObject;

        this.game_status = GameObject.Find("GameRoot").GetComponent <GameStatus>();
    }
    void Start()
    {
        this.step              = STEP.NONE; // 현 단계 상태를 초기화.
        this.next_step         = STEP.MOVE; // 다음 단계 상태를 초기화.
        this.item_root         = GameObject.Find("GameRoot").GetComponent <ItemRoot>();
        this.guistyle.fontSize = 16;

        this.guistyle.fontSize = 16;
        this.event_root        =
            GameObject.Find("GameRoot").GetComponent <EventRoot>();

        this.game_status              = GameObject.Find("GameRoot").GetComponent <GameStatus>();
        game_status.OnClickedSeedBtn += OnClickedSeedBtn;
    }
Exemplo n.º 13
0
        async public static void GetIM_Step07(HttpClient httpClient)
        {
            try
            {
                httpClient.DefaultRequestHeaders.Remove("Accept");
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ConfigData.ucwaAuthenticationResult.AccessToken);
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
                //httpClient.DefaultRequestHeaders.Add("Accept", "application/vnd.microsoft.com.ucwa+xml");

                string url_00 = ConfigData.ucwaApplicationsHost + ConfigData.ucwaEvents;
                ConfigData.Log("1", String.Format("Step 07 : GET : {0}", url_00));

                ConfigData.Log("3", String.Format(">> Request: {0}", "GET"));
                ConfigData.Log("3", String.Format(">> URL: {0}", url_00));
                // ConfigData.Log("3", String.Format("\r\n{0}", httpClient.DefaultRequestHeaders.ToString()));

                var res_00 = await httpClient.GetAsync(url_00);

                string res_00_request = res_00.RequestMessage.ToString();
                string res_00_headers = res_00.Headers.ToString();
                string res_00_status  = res_00.StatusCode.ToString();

                var res_00_content = await res_00.Content.ReadAsStringAsync();

                ConfigData.Log("3", String.Format(">> Response: {0}", res_00_status));
                ConfigData.Log("3", String.Format("{0}", res_00_headers));
                ConfigData.Log("3", String.Format("\r\n{0}", res_00_content));

                if (res_00_status == "OK")
                {
                    ConfigData.Log("6", String.Format(">> GetIM completed normally. {0}", "STEP06"));
                    EventRoot obj = new EventRoot();
                    JsonConvert.PopulateObject(res_00_content, obj);
                    if (obj != null)
                    {
                        ConfigData.ucwaEvents = obj._links.next.href;
                    }
                    GetIM_Step07(httpClient);
                }
                else
                {
                    ConfigData.Log("2", String.Format(">> Error in step 06. {0}", "No OK received"));
                }
            }
            catch (Exception ex)
            {
                ConfigData.Log("2", String.Format(">> Error in step 06. {0}", ex.InnerException.Message));
            }
        }
Exemplo n.º 14
0
    private GameObject carried_item_prev = null;                        //! 운반 중인 아이템.



    void Start()
    {
        this.step      = STEP.NONE;
        this.next_step = STEP.MOVE;
        this.item_root = GameObject.Find("GameRoot").GetComponent <ItemRoot>();

        this.event_root   = GameObject.Find("GameRoot").GetComponent <EventRoot>();
        this.rocket_model = GameObject.Find("rocket").transform.FindChild("rocket_model").gameObject;

        this.game_status   = GameObject.Find("GameRoot").GetComponent <GameStatus>();           // status
        this.animation     = this.transform.GetComponentInChildren <Animation>();               //motion
        this.sound_control = GameObject.Find("SoundRoot").GetComponent <SoundControl>();        // sound.


        this.effect_control = GameObject.Find("GameRoot").GetComponent <VanishEffectControl>();
    }
Exemplo n.º 15
0
        // 醫낅즺 泥댄겕.
        public bool             transition_check()
        {
            bool is_transit = false;

            if (this.player.step.get_time() >= use_motion_delay && this.player.control.getMotion() != "m004_use")
            {
                ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, this.slot_index);

                bool is_atari = (bool)this.item_favor.option0;

                if (is_atari)
                {
                    // 異⑸룎 ?대깽??
                    EventIceAtari event_atari = EventRoot.get().startEvent <EventIceAtari>();

                    event_atari.setItemSlotAndFavor(this.slot_index, this.item_favor);

                    this.player.step.set_next(STEP.MOVE);
                }
                else
                {
                    this.player.step.set_next(STEP.MOVE);
                }

                // ?꾩씠?쒖쓣 ??젣?쒕떎.
                if (this.slot_index >= 0)
                {
                    if (is_atari)
                    {
                        // 異⑸룎?덉쓣 ???꾩씠?쒖쓣 ??젣?섏? ?딅뒗??
                        // 異⑸룎 ????嫄몃줈 ?섎룎由곕떎.
                        this.player.item_slot.miscs[this.slot_index].favor.option0 = false;
                    }
                    else
                    {
                        this.player.item_slot.miscs[this.slot_index].initialize();

                        this.slot_index = -1;
                    }
                }

                is_transit = true;
            }

            return(is_transit);
        }
Exemplo n.º 16
0
    public float step_timer = 0.0f;      // 타이머.



    // Use this for initialization
    // event_root와 rocket_model 초기화 추가
    void Start()
    {
        this.step              = STEP.NONE; // 현 단계 상태를 초기화.
        this.next_step         = STEP.MOVE; // 다음 단계 상태를 초기화.
        this.item_root         = GameObject.Find("GameRoot").GetComponent <ItemRoot>();
        this.Title_effect      = GameObject.Find("Main Camera").GetComponent <TitleStart>();
        this.guistyle.fontSize = 16;
        this.event_root        =
            GameObject.Find("GameRoot").GetComponent <EventRoot>();
        this.rocket_model = GameObject.Find("rocket").transform.Find(
            "rocket_model").gameObject;
        this.game_status =
            GameObject.Find("GameRoot").GetComponent <GameStatus>();
        this.audio      = this.gameObject.AddComponent <AudioSource>();
        this.audio.clip = effect1;
        this.audio.loop = false;
    }
Exemplo n.º 17
0
        // 종료 체크.
        public bool             transition_check()
        {
            bool is_transit = false;

            if (this.player.step.get_time() >= use_motion_delay && this.player.control.getMotion() != "m004_use")
            {
                ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, this.slot_index);

                bool is_atari = (bool)this.item_favor.option0;

                if (is_atari)
                {
                    // 충돌 이벤트.
                    EventIceAtari event_atari = EventRoot.get().startEvent <EventIceAtari>();

                    event_atari.setItemSlotAndFavor(this.slot_index, this.item_favor);

                    this.player.step.set_next(STEP.MOVE);
                }
                else
                {
                    this.player.step.set_next(STEP.MOVE);
                }

                // 아이템을 삭제한다.
                if (this.slot_index >= 0)
                {
                    if (is_atari)
                    {
                        // 충돌했을 때 아이템을 삭제하지 않는다.
                        // 충돌 안 한 걸로 되돌린다.
                        this.player.item_slot.miscs[this.slot_index].favor.option0 = false;
                    }
                    else
                    {
                        this.player.item_slot.miscs[this.slot_index].initialize();

                        this.slot_index = -1;
                    }
                }

                is_transit = true;
            }

            return(is_transit);
        }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        goDir     = GameObject.Find("FrontDir");
        backDir   = GameObject.Find("BackDir");
        MapCamera = GameObject.Find("MiniMap");

        animator               = GetComponentInChildren <Animator>();
        willson                = GameObject.Find("WillsonTable");
        game_root              = GameObject.Find("GameRoot");
        this.step              = STEP.NONE; // 현 단계 상태를 초기화.
        this.next_step         = STEP.MOVE;
        this.item_root         = game_root.GetComponent <ItemRoot>();
        this.guistyle.fontSize = 16;

        this.event_root   = game_root.GetComponent <EventRoot>();
        this.rocket_model = GameObject.Find("boat").transform.FindChild("boat_model").gameObject;
        this.game_status  = game_root.GetComponent <GameStatus>();
        dt = game_root.GetComponent <DayTime>();

        _Torch = GameObject.Find("Torch");
        _Torch.SetActive(false);
    }
Exemplo n.º 19
0
    // ================================================================ //

    protected void disconnect_event()
    {
        if (GlobalParam.get().is_in_my_home == false &&
            GlobalParam.get().is_remote_in_my_home == false)
        {
            chrBehaviorPlayer player = this.net_player.behavior as chrBehaviorPlayer;

            if (player != null)
            {
                if (!player.isNowHouseMoving())
                {
                    HouseMoveStartEvent start_event = EventRoot.get().startEvent <HouseMoveStartEvent>();

                    start_event.setPrincipal(player);
                    start_event.setHouse(CharacterRoot.get().findCharacter <chrBehaviorNPC_House>("House1"));
                }
            }
        }
        else if (GlobalParam.get().is_in_my_home&&
                 GlobalParam.get().is_remote_in_my_home)
        {
            this.step.set_next(STEP.BYEBYE);
        }
    }
Exemplo n.º 20
0
 protected override bool OnExecuteEvent(EventRoot value, List <MappingFields> list) => EventController.Execute(value, list);
Exemplo n.º 21
0
    // ================================================================ //

    // 디버그 창을 만든다(플레이어 관련).
    protected void          create_debug_window_player()
    {
        var window = dbwin.root().createWindow("player");

        window.createButton("당했다")
        .setOnPress(() =>
        {
            var player = PartyControl.getInstance().getLocalPlayer();

            player.control.causeDamage(100.0f, -1);
        });

        window.createButton("아이스 과식")
        .setOnPress(() =>
        {
            var player = PartyControl.getInstance().getLocalPlayer();

            if (!player.isNowJinJin())
            {
                player.startJinJin();
            }
            else
            {
                player.stopJinJin();
            }
        });

        window.createButton("크림 범벅 테스트")
        .setOnPress(() =>
        {
            var player = PartyControl.getInstance().getLocalPlayer();

            if (!player.isNowCreamy())
            {
                player.startCreamy();
            }
            else
            {
                player.stopCreamy();
            }
        });

        window.createButton("체력 회복 테스트")
        .setOnPress(() =>
        {
            var player = PartyControl.getInstance().getLocalPlayer();

            if (!player.isNowHealing())
            {
                player.startHealing();
            }
            else
            {
                player.stopHealing();
            }
        });

        window.createButton("아이스 당첨 테스트")
        .setOnPress(() =>
        {
            window.close();
            EventRoot.get().startEvent <EventIceAtari>();
        });

        window.createButton("무기 교체")
        .setOnPress(() =>
        {
            var player = PartyControl.getInstance().getLocalPlayer();

            SHOT_TYPE shot_type = player.getShotType();

            shot_type = (SHOT_TYPE)(((int)shot_type + 1) % ((int)SHOT_TYPE.NUM));

            player.changeBulletShooter(shot_type);
        });
    }
Exemplo n.º 22
0
 public bool EventUpdate(EventRoot value) => Execute(value, (c, v) => c.EventUpdate((EventRoot)v));
Exemplo n.º 23
0
 public bool EventRegister(EventRoot value) => Execute(value, (c, v) => c.EventRegister((EventRoot)v));
Exemplo n.º 24
0
    void Start()
    {
        this.step = STEP.NONE; // 現ステップの状態を初期化.
        this.next_step = STEP.MOVE; // 次ステップの状態を初期化.

        this.item_root =
            GameObject.Find("GameRoot").GetComponent<ItemRoot>();
        this.guistyle.fontSize = 16;

        this.event_root =
            GameObject.Find("GameRoot").GetComponent<EventRoot>();
        this.rocket_model = GameObject.Find("rocket").transform.FindChild(
            "rocket_model").gameObject;
    }
Exemplo n.º 25
0
    void Start()
    {
        this.step      = STEP.NONE;
        this.next_step = STEP.MOVE;
        this.item_root    = GameObject.Find("GameRoot").GetComponent<ItemRoot>();

        this.event_root   = GameObject.Find("GameRoot").GetComponent<EventRoot>();
        this.rocket_model = GameObject.Find("rocket").transform.FindChild("rocket_model").gameObject;

        this.game_status  = GameObject.Find("GameRoot").GetComponent<GameStatus>();		// status
        this.animation = this.transform.GetComponentInChildren<Animation>();		//motion
        this.sound_control = GameObject.Find("SoundRoot").GetComponent<SoundControl>();	// sound.

        this.effect_control = GameObject.Find("GameRoot").GetComponent<VanishEffectControl>();
    }
Exemplo n.º 26
0
    void Start()
    {
        this.step = STEP.NONE; // 현 단계의 상태를 초기화.
        this.next_step = STEP.MOVE; // 다음 단계의 상태를 초기화.

        this.item_root =
            GameObject.Find("GameRoot").GetComponent<ItemRoot>();
        this.guistyle.fontSize = 16;

        this.event_root =
            GameObject.Find("GameRoot").GetComponent<EventRoot>();
        this.rocket_model = GameObject.Find("rocket").transform.FindChild(
            "rocket_model").gameObject;

        this.game_status =
            GameObject.Find("GameRoot").GetComponent<GameStatus>();
    }
 public EventRepository(EventRoot eventRoot)
 {
     _eventRoot = eventRoot;
 }
Exemplo n.º 28
0
    void    Update()
    {
        // ---------------------------------------------------------------- //
        // 다음 상태로 전환할지 체크합니다.

        switch (this.step.do_transition())
        {
        case STEP.WAIT_ENTER:
        {
            if (this.player != null)
            {
                this.step.set_next(STEP.ENTERED);
            }
        }
        break;

        case STEP.ENTERED:
        {
            if (YesNoAskDialog.get().isSelected())
            {
                if (YesNoAskDialog.get().getSelection() == YesNoAskDialog.SELECTION.YES)
                {
                    LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>();

                    if (leave_event != null)
                    {
                        leave_event.setPrincipal(this.player);
                        leave_event.setIsLocalPlayer(true);

                        // 정원 이동 요청 발행.
                        if (GameRoot.get().net_player)
                        {
                            GameRoot.get().NotifyFieldMoving();
                            GlobalParam.get().request_move_home = false;
                        }
                        else
                        {
                            GlobalParam.get().request_move_home = true;
                        }
                    }

                    this.step.set_next(STEP.IDLE);
                }
                else
                {
                    this.step.set_next(STEP.WAIT_LEAVE);
                }
            }
            else if (this.player == null)
            {
                this.step.set_next(STEP.LEAVE);
            }
        }
        break;

        case STEP.WAIT_LEAVE:
        {
            if (this.player == null)
            {
                this.step.set_next(STEP.LEAVE);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태가 전환되면 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.WAIT_ENTER:
            case STEP.IDLE:
            {
                this.player = null;

                YesNoAskDialog.get().close();
            }
            break;

            case STEP.ENTERED:
            {
                if (GlobalParam.get().is_in_my_home)
                {
                    YesNoAskDialog.get().setText("친구 정원에 놀러갈까요?");
                    YesNoAskDialog.get().setButtonText("간다", "안 간다");
                }
                else
                {
                    YesNoAskDialog.get().setText("집에 돌아갈까요?");
                    YesNoAskDialog.get().setButtonText("돌아간다", "더 논다");
                }
                YesNoAskDialog.get().dispatch();
            }
            break;

            case STEP.WAIT_LEAVE:
            {
                YesNoAskDialog.get().close();
            }
            break;

            case STEP.LEAVE:
            {
                YesNoAskDialog.get().close();

                this.step.set_next(STEP.WAIT_ENTER);
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.WAIT_ENTER:
        {
        }
        break;
        }
    }
Exemplo n.º 29
0
    // 매 프레임 호출.
    public override void            execute()
    {
        // ---------------------------------------------------------------- //
        // 다음 상태로 전환할지 체크.

        switch (this.step.do_transition())
        {
        case STEP.IN_ACTION:
        {
            var player = PartyControl.get().getLocalPlayer();

            if (player.step.get_current() == chrBehaviorLocal.STEP.WAIT_RESTART)
            {
                // 체력이 0이 되면 재시작.

                player.start();
                player.control.cmdSetPositionAnon(this.restart_point.position);
                player.control.cmdSetDirectionAnon(this.restart_point.direction);

                if (this.restart_point.door != null)
                {
                    this.restart_point.door.beginWaitLeave();
                }

                this.step.set_next(STEP.RESTART);
            }
            else
            {
                // 방 이동 이벤트 시작?.

                var ev = EventRoot.get().getCurrentEvent <TransportEvent>();

                if (ev != null)
                {
                    DoorControl door = ev.getDoor();

                    if (door.type == DoorControl.TYPE.FLOOR)
                    {
                        // 플로어 이동 도어일 때 .

                        this.is_floor_door_event = true;

                        ev.setEndAtHoleIn(true);
                    }
                    else
                    {
                        // 방 이동 도어일 때.
                        this.restart_point.door = door.connect_to;

                        this.is_floor_door_event = false;
                    }

                    this.step.set_next(STEP.TRANSPORT);
                }
            }
        }
        break;

        // 방 이동 이벤트 중.
        case STEP.TRANSPORT:
        {
            // 방 이동 이벤트가 끝나면 일반 모드로.

            var ev = EventRoot.get().getCurrentEvent <TransportEvent>();

            wait_counter += Time.deltaTime;

            if (ev == null)
            {
                if (this.is_floor_door_event)
                {
                    this.step.set_next(STEP.WAIT_FINISH);
                }
                else
                {
                    this.step.set_next(STEP.READY);

                    wait_counter = 0.0f;
                }
            }
            else
            {
                if (ev.step.get_current() == TransportEvent.STEP.READY)
                {
                    this.step.set_next(STEP.READY);

                    wait_counter = 0.0f;
                }
            }
        }
        break;

        // 'レディ!' 표시.
        // 쓰러졌을 때 재시작.
        case STEP.READY:
        case STEP.RESTART:
        {
            if (this.is_first_ready)
            {
                if (this.step.get_time() > 1.0f)
                {
                    this.step.set_next(STEP.IN_ACTION);
                    this.is_first_ready = false;
                }
            }
            else
            {
                var ev = EventRoot.get().getCurrentEvent <TransportEvent>();

                if (ev == null)
                {
                    this.step.set_next(STEP.IN_ACTION);
                }
            }
        }
        break;

        case STEP.WAIT_FINISH:
        {
            // 약긴 대기.
            wait_counter += Time.deltaTime;
            if (wait_counter > 3.0f)
            {
                this.step.set_next(STEP.FINISH);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태 전환 시 초기화.


        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.IN_ACTION:
            {
                Navi.get().dispatchPlayerMarker();

                LevelControl.get().endStillEnemies(null, 0.0f);
            }
            break;

            // 방 이동 이벤트 중.
            case STEP.TRANSPORT:
            {
                var current_room = PartyControl.get().getCurrentRoom();
                var next_room    = PartyControl.get().getNextRoom();

                // 다음 방에 적을 만든다.
                // 방 이동 이벤트 조료 시에 갑자기 적이 나타나지 않게.
                // 일짜김치 만들어 둔다.
                LevelControl.get().createRoomEnemies(next_room);

                LevelControl.get().beginStillEnemies(next_room);
                LevelControl.get().beginStillEnemies(current_room);
            }
            break;

            // 'レディ!표시.
            case STEP.READY:
            {
                var current_room = PartyControl.get().getCurrentRoom();
                var next_room    = PartyControl.get().getNextRoom();

                if (this.is_first_ready)
                {
                    LevelControl.get().createRoomEnemies(current_room);
                    LevelControl.get().beginStillEnemies(current_room);
                    LevelControl.get().onEnterRoom(current_room);
                }
                else
                {
                    LevelControl.get().onLeaveRoom(current_room);
                    LevelControl.get().onEnterRoom(next_room);
                }

                // 'レディ!' 표시
                Navi.get().dispatchYell(YELL_WORD.READY);

                // 전에 있던 방의 적을 삭제..
                if (next_room != current_room)
                {
                    LevelControl.get().deleteRoomEnemies(current_room);
                }

                ItemWindow.get().onRoomChanged(next_room);

                this.restart_point.position  = PartyControl.get().getLocalPlayer().control.getPosition();
                this.restart_point.direction = PartyControl.get().getLocalPlayer().control.getDirection();
            }
            break;

            // 쓰러진 후 재시작.
            case STEP.RESTART:
            {
                // 'レディ!' 표시.
                Navi.get().dispatchYell(YELL_WORD.READY);

                this.restart_point.position  = PartyControl.get().getLocalPlayer().control.getPosition();
                this.restart_point.direction = PartyControl.get().getLocalPlayer().control.getDirection();
            }
            break;

            case STEP.FINISH:
            {
                GameRoot.get().setNextScene("BossScene");
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.


        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.IN_ACTION:
        {
        }
        break;
        }

        // ---------------------------------------------------------------- //
    }
Exemplo n.º 30
0
 public bool EventUpdate(EventRoot value) => ExecuteEvent(value);
Exemplo n.º 31
0
 protected abstract bool OnExecuteEvent(EventRoot value, List <MappingFields> list);
Exemplo n.º 32
0
        async public static void GetIM_Step03_Events(HttpClient httpClient)
        {
            try
            {
                httpClient.DefaultRequestHeaders.Remove("Accept");
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ConfigData.ucwaAuthenticationResult.AccessToken);
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");

                string url_00 = ConfigData.ucwaApplicationsHost + ConfigData.ucwaEvents;

                ConfigData.Log("1", String.Format("Step 03 : GET : {0}", url_00));

                ConfigData.Log("3", String.Format(">> Request: {0}", "GET"));
                ConfigData.Log("3", String.Format(">> URL: {0}", url_00));

                var res_00 = await httpClient.GetAsync(url_00);

                string res_00_request = res_00.RequestMessage.ToString();
                string res_00_headers = res_00.Headers.ToString();
                string res_00_status  = res_00.StatusCode.ToString();
                var    res_00_content = await res_00.Content.ReadAsStringAsync();

                ConfigData.Log("3", String.Format(">> Response: {0}", res_00_status));
                ConfigData.Log("3", String.Format("{0}", res_00_headers));
                ConfigData.Log("3", String.Format("\r\n{0}", res_00_content));

                if (res_00_status == "OK")
                {
                    bool hendle = false;

                    EventRoot eventRoot = JsonConvert.DeserializeObject <EventRoot>(res_00_content);
                    //JsonConvert.PopulateObject(res_00_content, eventRoot);
                    if (eventRoot.sender?.Exists(s => s.events?.Exists(e => (e.status?.Equals("Success", StringComparison.OrdinalIgnoreCase) ?? false) && (e.type?.Equals("completed", StringComparison.OrdinalIgnoreCase) ?? false) && (e._embedded?.message?.direction?.Equals("Incoming", StringComparison.OrdinalIgnoreCase) ?? false)) ?? false) ?? false)
                    //if (res_00_content.Contains("Incoming") && res_00_content.Contains("completed"))
                    {
                        if (eventRoot != null)
                        {
                            if (eventRoot._links != null)
                            {
                                hendle = true;

                                List <UcwaSfboConsole3.Sender> sender = eventRoot.sender.FindAll(x => x.rel.Equals("conversation"));
                                if (sender != null)
                                {
                                    foreach (var item in sender)
                                    {
                                        List <UcwaSfboConsole3.Event> msgInvitation = item.events.FindAll(x => x.link.rel.Equals("message"));
                                        if (msgInvitation != null)
                                        {
                                            foreach (var item1 in msgInvitation)
                                            {
                                                if (item1._embedded != null && item1._embedded.message != null && item1._embedded.message.direction == "Incoming")
                                                {
                                                    string SendMessageUrl = item1._embedded.message._links.messaging.href;
                                                    ConfigData.ucwaEvents = eventRoot._links.next.href;

                                                    string message = string.Empty;

                                                    if (item1._embedded.message._links.htmlMessage != null)
                                                    {
                                                        message = Utilities.GetMessageFromHtml(item1._embedded.message._links.htmlMessage.href);
                                                    }
                                                    else if (item1._embedded.message._links.plainMessage != null)
                                                    {
                                                        message = Utilities.GetMessageFromHref(item1._embedded.message._links.plainMessage.href);
                                                    }

                                                    var conversationId = item.href.Split('/').Last();
                                                    var fromId         = item1._embedded.message._links.contact.href.Split('/').Last();

                                                    Activity activity = new Activity()
                                                    {
                                                        From = new ChannelAccount {
                                                            Id = fromId, Name = fromId
                                                        },
                                                        Conversation = new ConversationAccount {
                                                            Id = conversationId
                                                        },
                                                        Recipient = new ChannelAccount {
                                                            Id = "Bot"
                                                        },
                                                        ServiceUrl  = "https://skype.botframework.com",
                                                        ChannelId   = "skype",
                                                        ChannelData = SendMessageUrl
                                                    };

                                                    activity.Text = message;

                                                    using (var scope = Microsoft.Bot.Builder.Dialogs.Conversation
                                                                       .Container.BeginLifetimeScope(DialogModule.LifetimeScopeTag, builder => Configure(builder)))
                                                    {
                                                        scope.Resolve <IMessageActivity>
                                                            (TypedParameter.From((IMessageActivity)activity));
                                                        DialogModule_MakeRoot.Register
                                                            (scope, () => new EchoDialog());
                                                        var postToBot = scope.Resolve <IPostToBot>();
                                                        await postToBot.PostAsync(activity, CancellationToken.None);
                                                    }

                                                    //await UcwaSendMessage.SendIM_Step05(httpClient, "echo " + message, SendMessageUrl);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            GetIM_Step03_Events(httpClient);
                        }
                    }
                    else if (eventRoot.sender?.Exists(s => s.events?.Exists(e => (e?._embedded?.messagingInvitation?.state?.Equals("Connecting", StringComparison.OrdinalIgnoreCase) ?? false) && (e.type?.Equals("started", StringComparison.OrdinalIgnoreCase) ?? false) && (e._embedded?.messagingInvitation?.direction?.Equals("Incoming", StringComparison.OrdinalIgnoreCase) ?? false)) ?? false) ?? false)
                    //else if (res_00_content.Contains("Incoming") && res_00_content.Contains("Connecting"))
                    {
                        string message   = string.Empty;
                        string acceptUrl = string.Empty;
                        if (eventRoot != null)
                        {
                            if (eventRoot._links != null)
                            {
                                hendle = true;
                                ConfigData.ucwaEvents = eventRoot._links.next.href;

                                List <UcwaSfboConsole3.Sender> sender = eventRoot.sender.FindAll(x => x.rel.Equals("communication"));
                                if (sender != null)
                                {
                                    foreach (var item in sender)
                                    {
                                        List <UcwaSfboConsole3.Event> msgInvitation = item.events.FindAll(x => x.link.rel.Equals("messagingInvitation"));

                                        if (msgInvitation != null)
                                        {
                                            foreach (var item1 in msgInvitation)
                                            {
                                                if (item1._embedded != null && item1._embedded.messagingInvitation._links != null && item1._embedded.messagingInvitation._links.accept != null)
                                                {
                                                    acceptUrl = item1._embedded.messagingInvitation._links.accept.href;
                                                    message   = Utilities.GetMessageFromHref(item1._embedded.messagingInvitation._links.message.href);
                                                    await GetIM_Step04_MessageAccept(httpClient, acceptUrl, message);
                                                }
                                            }
                                        }
                                    }
                                }
                                GetIM_Step03_Events(httpClient);
                            }
                        }
                    }
                    else // if (hendle == false)
                    {
                        MessageRoot obj = new MessageRoot();
                        JsonConvert.PopulateObject(res_00_content, obj);
                        if (obj != null)
                        {
                            if (obj._links != null)
                            {
                                ConfigData.ucwaEvents = obj._links.next.href;
                            }
                        }
                        GetIM_Step03_Events(httpClient);
                    }
                }
                else
                {
                    ConfigData.Log("2", String.Format(">> Error in step 03. {0}", "No OK received"));
                }
            }
            catch (Exception ex)
            {
                if (ex.Message == "A task was canceled.")
                {
                    GetIM_Step03_Events(httpClient);
                }
                else
                {
                    ConfigData.Log("2", String.Format(">> Error in step 03. {0}", ex.InnerException.Message));
                }
            }
        }
Exemplo n.º 33
0
        async public static void GetIM_Step03_Events(HttpClient httpClient, TelemetryClient tc)
        {
            // Generic GetService< T> method is an extension method. Add namespace Microsoft.Extensions.DependencyInjection
            var textExtractionService = DI._serviceProvider.GetService <ITextExtraction>();
            var ucwaSetTypingService  = DI._serviceProvider.GetService <IUCWASetTyping>();

            try
            {
                httpClient.DefaultRequestHeaders.Remove("Accept");
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", UCWAConfiguration.authToken.access_token);
                httpClient.DefaultRequestHeaders.Add("Accept", "application/json");

                string url_00 = DI._config.GetSection("UCWA:ucwa_applications_host").Value + UCWAConfiguration.ucwaEvents;
                var    res_00 = await httpClient.GetAsync(url_00);

                string res_00_request = res_00.RequestMessage.ToString();
                string res_00_headers = res_00.Headers.ToString();
                string res_00_status  = res_00.StatusCode.ToString();
                var    res_00_content = await res_00.Content.ReadAsStringAsync();

                if (res_00_status == "OK")
                {
                    bool hendle = false;

                    EventRoot eventRoot = JsonConvert.DeserializeObject <EventRoot>(res_00_content);
                    //JsonConvert.PopulateObject(res_00_content, eventRoot);
                    if (eventRoot.sender?.Exists(s => s.events?.Exists(e => (e.status?.Equals("Success", StringComparison.OrdinalIgnoreCase) ?? false) && (e.type?.Equals("completed", StringComparison.OrdinalIgnoreCase) ?? false) && (e._embedded?.message?.direction?.Equals("Incoming", StringComparison.OrdinalIgnoreCase) ?? false)) ?? false) ?? false)
                    //if (res_00_content.Contains("Incoming") && res_00_content.Contains("completed"))
                    {
                        if (eventRoot != null)
                        {
                            if (eventRoot._links != null)
                            {
                                hendle = true;

                                List <Models.CommonEventRoot.Sender> sender = eventRoot.sender.FindAll(x => x.rel.Equals("conversation"));
                                if (sender != null)
                                {
                                    foreach (var item in sender)
                                    {
                                        List <Models.CommonEventRoot.Event> msgInvitation = item.events.FindAll(x => x.link.rel.Equals("message"));
                                        if (msgInvitation != null)
                                        {
                                            foreach (var item1 in msgInvitation)
                                            {
                                                if (item1._embedded != null && item1._embedded.message != null && item1._embedded.message.direction == "Incoming")
                                                {
                                                    string sendMessageUrl = item1._embedded.message._links.messaging.href;
                                                    UCWAConfiguration.ucwaEvents = eventRoot._links.next.href;

                                                    string message = string.Empty;

                                                    if (item1._embedded.message._links.htmlMessage != null)
                                                    {
                                                        message = await textExtractionService.GetMessageFromHtml(item1._embedded.message._links.htmlMessage.href);
                                                    }
                                                    else if (item1._embedded.message._links.plainMessage != null)
                                                    {
                                                        message = await textExtractionService.GetMessageFromHref(item1._embedded.message._links.plainMessage.href);
                                                    }

                                                    var conversationId = item.href.Split('/').Last();
                                                    var fromId         = item1._embedded.message._links.participant.title;
                                                    var emailLink      = item1._embedded.message._links.participant.href;
                                                    var emailID        = emailLink.Substring(emailLink.LastIndexOf("/") + 1);

                                                    //Send the user an impression that the bot is typing a message
                                                    string ucwaSetTypingUrl = DI._config.GetSection("UCWA:ucwa_applications_host").Value + UCWAConfiguration.ucwaApplication +
                                                                              UCWAConfiguration.ucwaConversationsUri + "/" + conversationId + UCWAConfiguration.ucwaSetTypingUri;
                                                    await ucwaSetTypingService.SetTyping(UCWAConfiguration._httpClient, UCWAConfiguration.authToken, ucwaSetTypingUrl,
                                                                                         UCWAConfiguration._tc);

                                                    // Create the Skype For Business On-Premise Adapter, and add Conversation State
                                                    // to the Bot. The Conversation State will be stored in memory.
                                                    var skypeForBusinessAdapter = DI._serviceProvider.GetService <ISkypeForBusinessOnPremAdapter>();

                                                    // Create the instance of our Bot.
                                                    var echoBotService = DI._serviceProvider.GetService <IEchoBot>();

                                                    // Connect the Skype For Business On-Premise Adapter to the Bot.
                                                    skypeForBusinessAdapter.ProcessActivityAsync(fromId, conversationId, sendMessageUrl, message,
                                                                                                 async(turnContext, cancellationToken) => await echoBotService.OnTurnAsync(turnContext)).Wait();
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            GetIM_Step03_Events(httpClient, tc);
                        }
                    }
                    else if (eventRoot.sender?.Exists(s => s.events?.Exists(e => (e?._embedded?.messagingInvitation?.state?.Equals("Connecting", StringComparison.OrdinalIgnoreCase) ?? false) && (e.type?.Equals("started", StringComparison.OrdinalIgnoreCase) ?? false) && (e._embedded?.messagingInvitation?.direction?.Equals("Incoming", StringComparison.OrdinalIgnoreCase) ?? false)) ?? false) ?? false)
                    //else if (res_00_content.Contains("Incoming") && res_00_content.Contains("Connecting"))
                    {
                        string message   = string.Empty;
                        string acceptUrl = string.Empty;
                        if (eventRoot != null)
                        {
                            if (eventRoot._links != null)
                            {
                                hendle = true;
                                UCWAConfiguration.ucwaEvents = eventRoot._links.next.href;

                                List <Models.CommonEventRoot.Sender> sender = eventRoot.sender.FindAll(x => x.rel.Equals("communication"));
                                if (sender != null)
                                {
                                    foreach (var item in sender)
                                    {
                                        List <Models.CommonEventRoot.Event> msgInvitation = item.events.FindAll(x => x.link.rel.Equals("messagingInvitation"));

                                        if (msgInvitation != null)
                                        {
                                            foreach (var item1 in msgInvitation)
                                            {
                                                if (item1._embedded != null && item1._embedded.messagingInvitation._links != null && item1._embedded.messagingInvitation._links.accept != null)
                                                {
                                                    acceptUrl = item1._embedded.messagingInvitation._links.accept.href;
                                                    message   = await textExtractionService.GetMessageFromHref(item1._embedded.messagingInvitation._links.message.href);
                                                    await GetIM_Step04_MessageAccept(httpClient, tc, acceptUrl, message);
                                                }
                                            }
                                        }
                                    }
                                }
                                GetIM_Step03_Events(httpClient, tc);
                            }
                        }
                    }
                    else // if (hendle == false)
                    {
                        MessageRoot obj = new MessageRoot();
                        JsonConvert.PopulateObject(res_00_content, obj);
                        if (obj != null)
                        {
                            if (obj._links != null)
                            {
                                UCWAConfiguration.ucwaEvents = obj._links.next.href;
                            }
                        }
                        GetIM_Step03_Events(httpClient, tc);
                    }
                }
                else
                {
                    //ConfigData.Log("2", String.Format(">> Error in step 03. {0}", "No OK received"));
                }
            }
            catch (Exception ex)
            {
                if (ex.Message == "A task was canceled.")
                {
                    GetIM_Step03_Events(httpClient, tc);
                }
                else
                //ConfigData.Log("2", String.Format(">> Error in step 03. {0}", ex.InnerException.Message));
                {
                    //Send the exception to App Insights
                    tc.TrackException(ex);
                    //Throw the exception
                    Console.WriteLine("Error occured in " + MethodBase.GetCurrentMethod().Name + ":" + ex.Message +
                                      " TargetSite:" + ex.TargetSite + " StackTrace: " + ex.StackTrace);
                    //throw new CustomException("Error occured in " + MethodBase.GetCurrentMethod().Name + ":" + ex.Message +
                    //    " TargetSite:" + ex.TargetSite + " StackTrace: " + ex.StackTrace);
                }
            }
        }