Beispiel #1
0
    public void WaitForFirstRoomToLookDirection(int bottom, int top, int left, int right)
    {

        waitingMode = WaitingEvent.W_ROOM_TO_LOOK_DIRECTION_FIRSTTIME;
        DirectionPanelScript dps = AskForDirectionAroundPlayer(gameInfos.idJoueur, bottom == 1, top == 1, left == 1, right == 1);
        dps.SetColor(ActionType.REGARDER);
    }
Beispiel #2
0
        public static ChaosEvent FromNativeEvent(NativeTypes.FABRIC_CHAOS_EVENT nativeEvent)
        {
            switch (nativeEvent.Kind)
            {
            case NativeTypes.FABRIC_CHAOS_EVENT_KIND.FABRIC_CHAOS_EVENT_KIND_STARTED:
                return(StartedEvent.FromNative(nativeEvent.Value));

            case NativeTypes.FABRIC_CHAOS_EVENT_KIND.FABRIC_CHAOS_EVENT_KIND_EXECUTING_FAULTS:
                return(ExecutingFaultsEvent.FromNative(nativeEvent.Value));

            case NativeTypes.FABRIC_CHAOS_EVENT_KIND.FABRIC_CHAOS_EVENT_KIND_STOPPED:
                return(StoppedEvent.FromNative(nativeEvent.Value));

            case NativeTypes.FABRIC_CHAOS_EVENT_KIND.FABRIC_CHAOS_EVENT_KIND_TEST_ERROR:
                return(TestErrorEvent.FromNative(nativeEvent.Value));

            case NativeTypes.FABRIC_CHAOS_EVENT_KIND.FABRIC_CHAOS_EVENT_KIND_VALIDATION_FAILED:
                return(ValidationFailedEvent.FromNative(nativeEvent.Value));

            case NativeTypes.FABRIC_CHAOS_EVENT_KIND.FABRIC_CHAOS_EVENT_KIND_WAITING:
                return(WaitingEvent.FromNative(nativeEvent.Value));

            default:
                return(null);
            }
        }
Beispiel #3
0
        public static ChaosEvent GetEventFromBytes(byte[] data)
        {
            ChaosEvent     e    = null;
            ChaosEventType type = (ChaosEventType)BitConverter.ToInt32(data, 0);

            switch (type)
            {
            case ChaosEventType.Started:
            {
                e = new StartedEvent();
            }

            break;

            case ChaosEventType.Stopped:
            {
                e = new StoppedEvent();
            }

            break;

            case ChaosEventType.ExecutingFaults:
            {
                e = new ExecutingFaultsEvent();
            }

            break;

            case ChaosEventType.ValidationFailed:
            {
                e = new ValidationFailedEvent();
            }

            break;

            case ChaosEventType.TestError:
            {
                e = new TestErrorEvent();
            }

            break;

            case ChaosEventType.Waiting:
            {
                e = new WaitingEvent();
            }

            break;
            }

            if (e != null)
            {
                byte[] eventData = new byte[data.Length - 4];
                Array.Copy(data, 4, eventData, 0, eventData.Length);
                e.FromBytes(eventData);
            }

            return(e);
        }
Beispiel #4
0
 public bool WaitToExec(WaitingEvent _waitingEvent, float _waitingTime)
 {
     if (isBusy)
     {
         return(false);
     }
     waitingEvent = _waitingEvent;
     waitingTime  = _waitingTime;
     startTime    = Time.time;
     isBusy       = true;
     return(true);
 }
Beispiel #5
0
    public void RoomSelected(int x, int y)
    {
        if(waitingMode == WaitingEvent.W_VISION_ROOM)
        {
            client.Send("20;" + gameInfos.idJoueur + ";" + x + ";" + y);
            waitingMode = WaitingEvent.W_NOTHING;

        }
        else if (waitingMode == WaitingEvent.W_MOBILE_ROOM)
        {
            client.Send("23;" + gameInfos.idJoueur + ";"+actualRoomX+";"+actualRoomY+";" + x + ";" + y);
            waitingMode = WaitingEvent.W_NOTHING;
        }
        else if (waitingMode == WaitingEvent.W_ILLUSION_ROOM)
        {
            client.Send("25;" + gameInfos.idJoueur + ";" + actualRoomX + ";" + actualRoomY + ";" + x + ";" + y);
            waitingMode = WaitingEvent.W_NOTHING;
        }
        else if (waitingMode == WaitingEvent.W_CONTROL_ROOM)
        {
            actualRoomX = x; actualRoomY = y;
            DirectionPanelScript dps = AskForDirectionAroundRoom(x, y, x != 2, x != 2, y != 2, y != 2);
            dps.SetColor(ActionType.CONTROLER);
        }
        complex.UnlightAll();
        complex.SetEveryRoomUnselectable();

    }
Beispiel #6
0
 public void ImmediateActionSet(int a)
 {
     immediateActionPanel.Disappear();
     client.Send("32;" + gameInfos.idJoueur + ";" + a);
     waitingMode = WaitingEvent.W_ACTIONS;
 }
Beispiel #7
0
 public void WaitForImmediateAction(int allowpousse, int allowcontrole, int allowdeplace, int allowregard)
 {
     immediateActionPanel.Appear();
     immediateActionPanel.AllowActions(allowpousse != 0, allowcontrole != 0, allowdeplace != 0, allowregard != 0);
     waitingMode = WaitingEvent.W_ACTIONS;
 }
Beispiel #8
0
 public void ActionsSet(int action1, int action2)
 {
     waitingMode = WaitingEvent.W_NOTHING;
     client.Send("13;" + gameInfos.idJoueur + ";" + (action1 - 1) + ";" + (action2 - 1));
     actionsPanel.DisableButtons();
 }
Beispiel #9
0
 public void WaitForAction(bool gele)
 {
     waitingMode = WaitingEvent.W_ACTIONS;
     //actionsPanel.SetActionsEnabled((allowpousse == 1), (allowregard == 1), (allowcontrole == 1), (allowdeplace == 1));
     actionsPanel.EnableButtons(gele);
 }
Beispiel #10
0
    public void SetDirection(Direction direction)
    {
        if (waitingMode == WaitingEvent.W_MOVEDIRECTION)
        {
            //MovePlayer(actualPlayer, direction);
            waitingMode = WaitingEvent.W_NOTHING;
            client.Send("17;" + gameInfos.idJoueur + ";2;" + (int)direction);
            //envoyer la direction au serveur

        }
        else if (waitingMode == WaitingEvent.W_ROOM_TO_LOOK_DIRECTION)
        {
            waitingMode = WaitingEvent.W_NOTHING;
            /*getRoomAtDir(actualPlayer.x, actualPlayer.y, direction).RevealHide();*/
            Vector2 pos = getPosAtDir(actualPlayer.x, actualPlayer.y, direction);
            client.Send("17;" + gameInfos.idJoueur + ";3;" + (int)pos.x + ";" + (int)pos.y);
        }
        else if (waitingMode == WaitingEvent.W_ROOM_TO_LOOK_DIRECTION_FIRSTTIME)
        {
            waitingMode = WaitingEvent.W_NOTHING;
            // getRoomAtDir(actualPlayer.x, actualPlayer.y, direction).RevealHide();
            Vector2 pos = getPosAtDir(actualPlayer.x, actualPlayer.y, direction);
            client.Send("11;" + gameInfos.idJoueur + ";" + (int)pos.x + ";" + (int)pos.y);
        }
        else if (waitingMode == WaitingEvent.W_CONTROLDIRECTION)
        {
            int linePos;
            waitingMode = WaitingEvent.W_NOTHING;
            if (direction == Direction.BAS || direction == Direction.HAUT)
                linePos = actualPlayer.x;
            else
                linePos = actualPlayer.y;

            client.Send("17;" + gameInfos.idJoueur + ";1;" + linePos + ";" + (int)direction);
            complex.UnlightAll();
            //complex.MoveLine(linePos, direction);
        }
        else if (waitingMode == WaitingEvent.W_CONTROL_ROOM)
        {
            int linePos;
            waitingMode = WaitingEvent.W_NOTHING;
            if (direction == Direction.BAS || direction == Direction.HAUT)
                linePos = actualRoomX;
            else
                linePos = actualRoomY;
            print("TEST");
            client.Send("24;" + gameInfos.idJoueur + ";" + linePos + ";" + (int)direction);
            //complex.MoveLine(linePos, direction);
        }else if(waitingMode == WaitingEvent.W_PLAYER_PUSH)
        {
            client.Send("17;" + gameInfos.idJoueur + ";0;" + actPlayer + ";" + (int)direction);
            waitingMode = WaitingEvent.W_NOTHING;
        }
        complex.UnlightAll();

    }
Beispiel #11
0
 public void WaitForIllusionRoom(int x, int y, string roomsString)
 {
     waitingMode = WaitingEvent.W_ILLUSION_ROOM;
     actualRoomX = x; actualRoomY = y;
     complex.SetSelectableRooms(roomsString);
 }
Beispiel #12
0
 public void WaitForControlLine()
 {
     waitingMode = WaitingEvent.W_CONTROL_ROOM;
     complex.SetEveryRoomSelectable();
     complex.SetSelectable(2, 2, false);
 }
Beispiel #13
0
 public void WaitForMobileRoom(int x, int y, string roomsString)
 {
     waitingMode = WaitingEvent.W_MOBILE_ROOM;
     actualRoomX = x; actualRoomY = y;
     complex.SetSelectableRooms(roomsString);
 }
Beispiel #14
0
 public void WaitForVisionRoom(string roomsString)
 {
     waitingMode = WaitingEvent.W_VISION_ROOM;
     complex.SetSelectableRooms(roomsString);
 }
Beispiel #15
0
        /// <summary>
        /// Normally a <pre>video</pre> element doesn't have a <pre>change</pre> event.
        /// We force one and a use it as a proxy for all the Media Events.
        /// </summary>
        /// <param name="args">The event args - Value contains our JSON</param>
        protected virtual void OnChange(ChangeEventArgs args)
        {
            var            ThisEvent = args?.Value?.ToString();
            VideoEventData videoData = new VideoEventData();

            try
            {
                videoData = JsonSerializer.Deserialize <VideoEventData>(ThisEvent, serializationOptions);
            }
            catch (Exception ex)
            {
                LoggerFactory
                .CreateLogger(nameof(VideoExComponentBase))
                .LogError(ex, "Failed to convert the JSON: {0}", ThisEvent);
            }

            switch (videoData.EventName)
            {
            case VideoEvents.Abort:
                Abort?.Invoke(videoData.State);
                AbortEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.CanPlay:
                CanPlay?.Invoke(videoData.State);
                CanPlayEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.CanPlayThrough:
                CanPlayThrough?.Invoke(videoData.State);
                CanPlayThroughEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.DurationChange:
                DurationChange?.Invoke(videoData.State);
                DurationChangeEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Emptied:
                Emptied?.Invoke(videoData.State);
                EmptiedEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Ended:
                Ended?.Invoke(videoData.State);
                EndedEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Error:
                Error?.Invoke(videoData.State);
                ErrorEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.LoadedData:
                LoadedData?.Invoke(videoData.State);
                LoadedDataEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.LoadedMetadata:
                LoadedMetadata?.Invoke(videoData.State);
                LoadedMetadataEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.LoadStart:
                LoadStart?.Invoke(videoData.State);
                LoadStartEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Pause:
                Pause?.Invoke(videoData.State);
                PauseEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Play:
                Play?.Invoke(videoData.State);
                PlayEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Playing:
                Playing?.Invoke(videoData.State);
                PlayingEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Progress:
                Progress?.Invoke(videoData.State);
                ProgressEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.RateChange:
                RateChange?.Invoke(videoData.State);
                RateChangeEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Seeked:
                Seeking?.Invoke(videoData.State);
                SeekingEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Seeking:
                Seeking?.Invoke(videoData.State);
                SeekingEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Stalled:
                Stalled?.Invoke(videoData.State);
                StalledEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Suspend:
                Suspend?.Invoke(videoData.State);
                SuspendEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.TimeUpdate:
                TimeUpdate?.Invoke(videoData.State);
                TimeUpdateEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.VolumeChange:
                VolumeChange?.Invoke(videoData.State);
                VolumeChangeEvent.InvokeAsync(videoData.State);
                break;

            case VideoEvents.Waiting:
                Waiting?.Invoke(videoData.State);
                WaitingEvent.InvokeAsync(videoData.State);
                break;

            default:
                break;
            }
            // Here is our catch-all event handler call!
            EventFired?.Invoke(videoData);
        }
Beispiel #16
0
 public void WaitForMoveDirection(int bottom, int top, int left, int right)
 {
     waitingMode = WaitingEvent.W_MOVEDIRECTION;
     DirectionPanelScript dps = AskForDirectionAroundPlayer(gameInfos.idJoueur, bottom == 1, top == 1, left == 1, right == 1);
     dps.SetColor(ActionType.DEPLACER);
 }
Beispiel #17
0
 public void WaitForPlayerToPush(int bottom, int top, int left, int right, string playersString)
 {
     waitingMode = WaitingEvent.W_PLAYER_PUSH;
     choosePlayerScript.Appear();
     choosePlayerScript.LoadButtons(bottom, top, left, right, playersString);
 }