Inheritance: MonoBehaviour
示例#1
0
    void Awake()
    {
        OnMouseClickEvent     = new MouseClickEvent();
        OnEnvChangeShapeEvent = new EnvChangeShapeEvent();

        OnStaticCaseItemEvent   = new StaticCaseItemEvent();
        OnRightButtonClickEvent = new RightButtonClickEvent();

        OnDoorEvent = new DoorEvent();
        OnCaseEvent = new CaseEvent();

        OnNextQuestEvent = new NextQuestEvent();
        //OnDialogEvent = new QuestDialogEvent();
        OnUseOnPlayerEvent = new UseOnPlayerEvent();
        OnStartDialogEvent = new StartDialogEvent();

        OnTerminalOpen  = new TerminalEvent();
        OnTerminalClose = new TerminalEvent();

        OnChangeSpriteEvent = new ChangeSpriteEvent();

        OnNewTicEvent     = new NewTicEvent();
        OnAddBuffEvent    = new AddBuffEvent();
        OnRemoveBuffEvent = new RemoveBuffEvent();
    }
 public void OnDoorUse(Player p, DoorEvent de)
 {
     this.Invoke("On_DoorUse", new object[]
     {
         p,
         de
     });
 }
 public void AddDoorEvent(DoorEvent door)
 {
     if (door != null)
     {
         door.eventID = GenerateUUID();
         Instance.doorList.Add(door);
     }
 }
示例#4
0
 void OnDoorUse(Fougerite.Player param0, DoorEvent param1)
 {
     foreach (KeyValuePair <string, V8Plugin> plugin in plugins)
     {
         plugin.Value.Invoke("On_DoorUse", param0, param1); // Deprecated
         plugin.Value.Invoke("OnDoorUse", param0, param1);
     }
 }
示例#5
0
 bool OpenDoor(DoorEvent e, Action <bool> continuation)
 {
     Raise(new PushSceneEvent(SceneId.Inventory));
     _continuation?.Invoke(false);
     SetMode(e);
     _continuation = continuation;
     return(true);
 }
示例#6
0
 public bool OnDoorClose()  // Close door
 {
     // Door closed or locked = kan ikke close
     if (!_doorOpen || !_doorUnlocked)
     {
         return(_doorOpen);
     }
     _doorOpen       = false;
     State.DoorState = false;
     DoorEvent?.Invoke(this, State);
     return(_doorOpen);
 }
示例#7
0
 //CLose the door
 public void DoorClosed()
 {
     if (!DoorState || !LockState)
     {
         return; // Returns if the door is closed or locked
     }
     //Sets new states
     doorEventState.DoorState = false;
     DoorState = false;
     //Event invoke
     DoorEvent?.Invoke(this, doorEventState);
 }
示例#8
0
 //Open the door
 public void DoorOpen()
 {
     if (DoorState || !LockState)
     {
         return; // Returns if the door is open or locked
     }
     //Sets new states
     doorEventState.DoorState = true;
     DoorState = true;
     //Event invoke
     DoorEvent?.Invoke(this, doorEventState);
 }
示例#9
0
    private bool TryStep(OrthoDir dir)
    {
        Vector2Int vectors = GetComponent <MapEvent>().position;
        Vector2Int vsd     = VectorForDir(dir);
        Vector2Int target  = vectors + vsd;

        GetComponent <CharaEvent>().facing = dir;
        List <MapEvent> targetEvents = GetComponent <MapEvent>().parent.GetEventsAt(target);

        List <MapEvent> toCollide = new List <MapEvent>();
        bool            passable  = parent.CanPassAt(target);

        foreach (MapEvent targetEvent in targetEvents)
        {
            toCollide.Add(targetEvent);
            if (!parent.CanPassAt(target))
            {
                passable = false;
            }
        }

        if (passable)
        {
            wantsToTrack = true;
            StartCoroutine(CoUtils.RunWithCallback(GetComponent <MapEvent>().StepRoutine(dir), () => {
                foreach (MapEvent targetEvent in toCollide)
                {
                    if (targetEvent.switchEnabled)
                    {
                        targetEvent.GetComponent <Dispatch>().Signal(MapEvent.EventCollide, this);
                    }
                }
            }));
        }
        else
        {
            foreach (MapEvent targetEvent in toCollide)
            {
                if (targetEvent.switchEnabled && !targetEvent.IsPassableBy(parent))
                {
                    targetEvent.GetComponent <Dispatch>().Signal(MapEvent.EventCollide, this);
                }
            }
            DoorEvent door = GetComponent <MapEvent>().parent.GetEventAt <DoorEvent>(vectors);
            if (door != null)
            {
                Global.Instance().StartCoroutine(door.TeleportRoutine(this));
            }
        }

        return(true);
    }
示例#10
0
 public bool OnDoorOpen() // Åben door
 {
     // Already Open or locked = kan ikke doorOpen
     if (_doorOpen || !_doorUnlocked)
     {
         return(_doorOpen);
     }
     _doorOpen       = true;
     State.DoorState = true;
     //Event til Station control
     DoorEvent?.Invoke(this, State);
     return(_doorOpen);
 }
示例#11
0
 // Activates when the User opens the door
 public void DoorOpened()
 {
     //If the Door is already open or locked return
     if (DoorState || DoorLocked)
     {
         return;
     }
     // Sets state
     State.DoorState = true;
     DoorState       = true;
     // Invoke Event
     DoorEvent?.Invoke(this, State);
 }
示例#12
0
 // Activates when the User closes the door
 public void DoorClosed()
 {
     // If the door is already closed return
     if (!DoorState || DoorLocked)
     {
         return;
     }
     // Sets state
     State.DoorState = false;
     DoorState       = false;
     // Invokes event
     DoorEvent?.Invoke(this, State);
 }
示例#13
0
 public void OnDoorClose()
 {
     if (!Open)
     {
         Console.WriteLine("Man kan ikke lukke en lukket dør(Door Simulator)");
         return;
     }
     Open = false;
     DoorEvent?.Invoke(this, new DoorEventArgs()
     {
         IsDoorOpen = false
     });
 }
示例#14
0
    //Door Event
    public void NewDoorEvent()
    {
        DoorEvent doorEvent = new DoorEvent();

        if (player)
        {
            DoorOpenCount++;
            doorEvent.seconds_since_start = timer_since_start;
            doorEvent.door_num            = DoorOpenCount;
        }

        writer.AddDoorEvent(doorEvent);
    }
示例#15
0
        public static bool CheckOwner(DeployableObject obj, Controllable controllable)
        {
            DoorEvent de = new DoorEvent(new Entity(obj));

            if (obj.ownerID == controllable.playerClient.userID)
            {
                de.Open = true;
            }
            if ((obj.GetComponent <BasicDoor>() != null) && (OnDoorUse != null))
            {
                OnDoorUse(Magma.Player.FindByPlayerClient(controllable.playerClient), de);
            }
            return(de.Open);
        }
示例#16
0
        public static bool CheckOwner(DeployableObject obj, Controllable controllable)
        {
            DoorEvent doorEvent = new DoorEvent(new Entity(obj));

            if (obj.ownerID == controllable.playerClient.userID)
            {
                doorEvent.Open = true;
            }
            if (obj.GetComponent <BasicDoor>() != null && Hooks.OnDoorUse != null)
            {
                Hooks.OnDoorUse(Player.FindByPlayerClient(controllable.playerClient), doorEvent);
            }
            return(doorEvent.Open);
        }
示例#17
0
 public static DoorEvent Serdes(DoorEvent e, AssetMapping mapping, ISerializer s, TextId textSourceId)
 {
     if (s == null)
     {
         throw new ArgumentNullException(nameof(s));
     }
     e ??= new DoorEvent(textSourceId);
     e.PickDifficulty = s.UInt8(nameof(PickDifficulty), e.PickDifficulty);
     e.Key            = ItemId.SerdesU16(nameof(Key), e.Key, AssetType.Item, mapping, s);
     e.OpenedText     = s.UInt8(nameof(OpenedText), e.OpenedText);
     e.UnlockedText   = s.UInt8(nameof(UnlockedText), e.UnlockedText);
     e.DoorId         = DoorId.SerdesU16(nameof(DoorId), e.DoorId, mapping, s); // Usually 100+
     return(e);
 }
示例#18
0
        public static bool CheckOwner(DeployableObject obj, Controllable controllable)
        {
            DoorEvent de = new DoorEvent(new Entity(obj));

            if (obj.ownerID == controllable.playerClient.userID)
            {
                de.Open = true;
            }

            if (!(obj is SleepingBag) && OnDoorUse != null)
            {
                OnDoorUse(Fougerite.Server.Cache[controllable.playerClient.userID], de);
            }

            return(de.Open);
        }
示例#19
0
        public void OnDoorUse(Fougerite.Player p, DoorEvent de)
        {
            BasicDoor door = (from collider in Physics.OverlapSphere(p.Location, 3f, doorLayer) where collider.GetComponent <BasicDoor>() select collider.GetComponent <BasicDoor>()).FirstOrDefault();

            if (DataStore.GetInstance().Get("AutoCloser", p.UID) != null && door != null)
            {
                if (door.state.ToString() != "Closed")
                {
                    return;
                }
                int i    = (int)DataStore.GetInstance().Get("AutoCloser", p.UID);
                var dict = new Dictionary <string, object>();
                dict["Loc"]  = p.Location;
                dict["Door"] = door;
                var c = 1000 * i;
                CreateParallelTimer(c, dict).Start();
            }
        }
示例#20
0
 void DoorUse(Fougerite.Player p, DoorEvent de)
 {
     if (Core.IsEnabled() && !de.Open)
     {
         ShareCommand command = ChatCommand.GetCommand("share") as ShareCommand;
         ArrayList    list    = (ArrayList)command.GetSharedDoors()[de.Entity.OwnerID];
         if (list == null)
         {
             de.Open = false;
         }
         else if (list.Contains(p.PlayerClient.userID))
         {
             de.Open = true;
         }
         else
         {
             de.Open = false;
         }
     }
 }
示例#21
0
        public async Task SendAsync(DoorEvent doorEvent, string topicName, string topicKey)
        {
            TopicCredentials credentials = new TopicCredentials(topicKey);
            EventGridClient  client      = new EventGridClient(credentials);
            EventGridEvent   gridEvent   = new EventGridEvent
            {
                Id          = Guid.NewGuid().ToString(),
                Subject     = "Test subject 1",
                EventType   = "IOT event",
                EventTime   = DateTime.UtcNow,
                Data        = doorEvent,
                DataVersion = "1.0.0"
            };

            List <EventGridEvent> events = new List <EventGridEvent>
            {
                gridEvent
            };

            await client.PublishEventsWithHttpMessagesAsync(topicName, events);
        }
示例#22
0
 public void OnDoorOpen()
 {
     if (Open)
     {
         Console.WriteLine("Man kan ikke åbne en åben dør");
     }
     else
     {
         if (Islocked)
         {
             Console.WriteLine("Døren er låst. Du kan ikke åbne den (Door Simulator)");
             return;
         }
         Open = true;
         // Console.WriteLine("Døren er åben.");
         DoorEvent?.Invoke(this, new DoorEventArgs()
         {
             IsDoorOpen = true
         });
     }
 }
示例#23
0
        public InventoryScreen(
            IEvent modeEvent,
            PartyMemberId activeCharacter,
            Func <InventoryPage> getPage,
            Action <InventoryPage> setPage) : base(DialogPositioning.TopLeft)
        {
            if (modeEvent == null)
            {
                throw new ArgumentNullException(nameof(modeEvent));
            }
            if (getPage == null)
            {
                throw new ArgumentNullException(nameof(getPage));
            }
            if (setPage == null)
            {
                throw new ArgumentNullException(nameof(setPage));
            }

            var leftPane =
                modeEvent switch
            {
                InventoryOpenEvent ioe => new InventoryCharacterPane(activeCharacter, getPage, setPage),
                MerchantEvent me => new InventoryMerchantPane(me.MerchantId),
                ChestEvent ce => ce.PickDifficulty == 0 ? (IUiElement) new InventoryChestPane(ce.ChestId) : new InventoryLockPane(ce),
                DoorEvent de => new InventoryLockPane(de),
                _ => throw new InvalidOperationException($"Unexpected inventory mode event {modeEvent}")
            };

            var middlePane = new InventoryMidPane(activeCharacter);
            var rightPane  = new InventoryRightPane(activeCharacter, modeEvent is MerchantEvent);

            // var frameDivider = new FrameDivider(135, 0, 4, 192);

            AttachChild(new UiFixedPositionElement(Base.UiBackground.Slab, UiConstants.UiExtents));
            AttachChild(new FixedPosition(new Rectangle(0, 0, 135, UiConstants.ActiveAreaExtents.Height), leftPane));
            AttachChild(new FixedPosition(new Rectangle(142, 0, 134, UiConstants.ActiveAreaExtents.Height), middlePane));
            AttachChild(new FixedPosition(new Rectangle(280, 0, 71, UiConstants.ActiveAreaExtents.Height), rightPane));
        }
    }
示例#24
0
文件: Hooks.cs 项目: balu92/Fougerite
        public static bool CheckOwner(DeployableObject obj, Controllable controllable)
        {
            try
            {
                DoorEvent de = new DoorEvent(new Entity(obj));
                if (obj.ownerID == controllable.playerClient.userID)
                {
                    de.Open = true;
                }

                if (!(obj is SleepingBag) && OnDoorUse != null)
                {
                    OnDoorUse(Fougerite.Player.FindByPlayerClient(controllable.playerClient), de);
                }
                return(de.Open);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return(false);
        }
示例#25
0
        static Event ParseEvent(IDataReader dataReader)
        {
            Event @event;
            var   type = (EventType)dataReader.ReadByte();

            switch (type)
            {
            case EventType.Teleport:
            {
                // 1. byte is the x coordinate
                // 2. byte is the y coordinate
                // 3. byte is the character direction
                // Then 1 unknown byte
                // Then 1 byte for the transtion type (0-5)
                // Then a word for the map index
                // Then 2 unknown bytes (seem to be 00 FF)
                uint x          = dataReader.ReadByte();
                uint y          = dataReader.ReadByte();
                var  direction  = (CharacterDirection)dataReader.ReadByte();
                var  unknown1   = dataReader.ReadByte();
                var  transition = (TeleportEvent.TransitionType)dataReader.ReadByte();
                uint mapIndex   = dataReader.ReadWord();
                var  unknown2   = dataReader.ReadBytes(2);
                @event = new TeleportEvent
                {
                    MapIndex   = mapIndex,
                    X          = x,
                    Y          = y,
                    Direction  = direction,
                    Transition = transition,
                    Unknown1   = unknown1,
                    Unknown2   = unknown2,
                };
                break;
            }

            case EventType.Door:
            {
                // 1. byte is a lockpicking chance reduction (0: already open, 100: can't open via lockpicking)
                // 2. byte is the door index (used for unlock bits in savegame)
                // 3. byte is an optional text index that is shown initially (0xff = no text)
                // 4. byte is an optional text index if the door was unlocked (0xff = no text)
                // 5. byte is unknown (always 0)
                // word at position 6 is the key index if a key must unlock it
                // last word is the event index (0-based) of the event that is called when unlocking fails
                var  lockpickingChanceReduction = dataReader.ReadByte();
                var  doorIndex            = dataReader.ReadByte();
                var  textIndex            = dataReader.ReadByte();
                var  unlockTextIndex      = dataReader.ReadByte();
                var  unused               = dataReader.ReadByte();
                uint keyIndex             = dataReader.ReadWord();
                var  unlockFailEventIndex = dataReader.ReadWord();
                @event = new DoorEvent
                {
                    LockpickingChanceReduction = lockpickingChanceReduction,
                    DoorIndex              = doorIndex,
                    TextIndex              = textIndex,
                    UnlockTextIndex        = unlockTextIndex,
                    Unused                 = unused,
                    KeyIndex               = keyIndex,
                    UnlockFailedEventIndex = unlockFailEventIndex
                };
                break;
            }

            case EventType.Chest:
            {
                // 1. byte is a lockpicking chance reduction (0: already open, 100: can't open via lockpicking)
                // 2. byte are the chest flags
                // 3. byte is an optional text index (0xff = no text)
                // 4. byte is the chest index (0-based)
                // 5. byte (0 = chest, 1 = pile/removable loot or item) or "remove if empty"
                // word at position 6 is the key index if a key must unlock it
                // last word is the event index (0-based) of the event that is called when unlocking fails
                var  lockpickingChanceReduction = dataReader.ReadByte();
                var  flags                = (ChestEvent.ChestFlags)dataReader.ReadByte();
                var  textIndex            = dataReader.ReadByte();
                uint chestIndex           = dataReader.ReadByte();
                bool removeWhenEmpty      = dataReader.ReadByte() != 0;
                uint keyIndex             = dataReader.ReadWord();
                var  unlockFailEventIndex = dataReader.ReadWord();
                @event = new ChestEvent
                {
                    LockpickingChanceReduction = lockpickingChanceReduction,
                    Flags                  = flags,
                    TextIndex              = textIndex,
                    ChestIndex             = chestIndex,
                    RemoveWhenEmpty        = removeWhenEmpty,
                    KeyIndex               = keyIndex,
                    UnlockFailedEventIndex = unlockFailEventIndex
                };
                break;
            }

            case EventType.PopupText:
            {
                // event image index (0xff = no image)
                // trigger (1 = move, 2 = eye cursor, 3 = both)
                // unknown boolean
                // map text index as word
                // 4 unknown bytes
                var eventImageIndex = dataReader.ReadByte();
                var popupTrigger    = (EventTrigger)dataReader.ReadByte();
                var unknownBool     = dataReader.ReadByte() != 0;
                var textIndex       = dataReader.ReadWord();
                var unknown         = dataReader.ReadBytes(4);
                @event = new PopupTextEvent
                {
                    EventImageIndex = eventImageIndex,
                    PopupTrigger    = popupTrigger,
                    TextIndex       = textIndex,
                    UnknownBool     = unknownBool,
                    Unknown         = unknown
                };
                break;
            }

            case EventType.Spinner:
            {
                var direction = (CharacterDirection)dataReader.ReadByte();
                var unused    = dataReader.ReadBytes(8);
                @event = new SpinnerEvent
                {
                    Direction = direction,
                    Unused    = unused
                };
                break;
            }

            case EventType.Trap:
            {
                var ailment         = (TrapEvent.TrapAilment)dataReader.ReadByte();
                var target          = (TrapEvent.TrapTarget)dataReader.ReadByte();
                var affectedGenders = (GenderFlag)dataReader.ReadByte();
                var baseDamage      = dataReader.ReadByte();
                var unused          = dataReader.ReadBytes(5); // unused
                @event = new TrapEvent
                {
                    Ailment         = ailment,
                    Target          = target,
                    AffectedGenders = affectedGenders,
                    BaseDamage      = baseDamage,
                    Unused          = unused
                };
                break;
            }

            case EventType.RemoveBuffs:
            {
                byte affectedBuffs = dataReader.ReadByte();
                var  unused        = dataReader.ReadBytes(8);
                @event = new RemoveBuffsEvent
                {
                    AffectedBuff = affectedBuffs == 0 ? (ActiveSpellType?)null: (ActiveSpellType)(affectedBuffs - 1),
                    Unused       = unused
                };
                break;
            }

            case EventType.Riddlemouth:
            {
                var introTextIndex          = dataReader.ReadByte();
                var solutionTextIndex       = dataReader.ReadByte();
                var unused                  = dataReader.ReadBytes(3);
                var correctAnswerTextIndex1 = dataReader.ReadWord();
                var correctAnswerTextIndex2 = dataReader.ReadWord();
                @event = new RiddlemouthEvent
                {
                    RiddleTextIndex               = introTextIndex,
                    SolutionTextIndex             = solutionTextIndex,
                    CorrectAnswerDictionaryIndex1 = correctAnswerTextIndex1,
                    CorrectAnswerDictionaryIndex2 = correctAnswerTextIndex2,
                    Unused = unused
                };
                break;
            }

            case EventType.Award:
            {
                var awardType      = (AwardEvent.AwardType)dataReader.ReadByte();
                var awardOperation = (AwardEvent.AwardOperation)dataReader.ReadByte();
                var random         = dataReader.ReadByte() != 0;
                var awardTarget    = (AwardEvent.AwardTarget)dataReader.ReadByte();
                var unknown        = dataReader.ReadByte();
                var awardTypeValue = dataReader.ReadWord();
                var value          = dataReader.ReadWord();
                @event = new AwardEvent
                {
                    TypeOfAward    = awardType,
                    Operation      = awardOperation,
                    Random         = random,
                    Target         = awardTarget,
                    AwardTypeValue = awardTypeValue,
                    Value          = value,
                    Unknown        = unknown
                };
                break;
            }

            case EventType.ChangeTile:
            {
                var x              = dataReader.ReadByte();
                var y              = dataReader.ReadByte();
                var unknown        = dataReader.ReadBytes(3);
                var frontTileIndex = dataReader.ReadWord();     // also wall/object index in lower byte
                var mapIndex       = dataReader.ReadWord();
                @event = new ChangeTileEvent
                {
                    X = x,
                    Y = y,
                    FrontTileIndex = frontTileIndex,
                    MapIndex       = mapIndex,
                    Unknown        = unknown
                };
                break;
            }

            case EventType.StartBattle:
            {
                var unknown1          = dataReader.ReadBytes(6);
                var monsterGroupIndex = dataReader.ReadByte();
                var unknown2          = dataReader.ReadBytes(2);
                @event = new StartBattleEvent
                {
                    MonsterGroupIndex = monsterGroupIndex,
                    Unknown1          = unknown1,
                    Unknown2          = unknown2
                };
                break;
            }

            case EventType.EnterPlace:
            {
                // map text index when closed (0xff is default message)
                // place type (see PlaceType)
                // opening hour
                // closing hour
                // text index for using the place (sleep, train, buy, etc)
                // place index (1-based, word)
                // 2 unknown bytes
                var textIndexWhenClosed = dataReader.ReadByte();
                var placeType           = (PlaceType)dataReader.ReadByte();
                var openingHour         = dataReader.ReadByte();
                var closingHour         = dataReader.ReadByte();
                var usePlaceTextIndex   = dataReader.ReadByte();
                var placeIndex          = dataReader.ReadWord();
                var merchantIndex       = dataReader.ReadWord();
                @event = new EnterPlaceEvent
                {
                    ClosedTextIndex   = textIndexWhenClosed,
                    PlaceType         = placeType,
                    OpeningHour       = openingHour,
                    ClosingHour       = closingHour,
                    PlaceIndex        = placeIndex,
                    UsePlaceTextIndex = usePlaceTextIndex,
                    MerchantDataIndex = merchantIndex
                };
                break;
            }

            case EventType.Condition:
            {
                var conditionType        = (ConditionEvent.ConditionType)dataReader.ReadByte();
                var value                = dataReader.ReadByte();
                var count                = dataReader.ReadByte();
                var unknown1             = dataReader.ReadBytes(2);
                var objectIndex          = dataReader.ReadWord();
                var jumpToIfNotFulfilled = dataReader.ReadWord();
                @event = new ConditionEvent
                {
                    TypeOfCondition = conditionType,
                    ObjectIndex     = objectIndex,
                    Value           = value,
                    Count           = count,
                    Unknown1        = unknown1,
                    ContinueIfFalseWithMapEventIndex = jumpToIfNotFulfilled
                };
                break;
            }

            case EventType.Action:
            {
                var actionType  = (ActionEvent.ActionType)dataReader.ReadByte();
                var value       = dataReader.ReadByte();
                var count       = dataReader.ReadByte();
                var unknown1    = dataReader.ReadBytes(2);
                var objectIndex = dataReader.ReadWord();
                var unknown2    = dataReader.ReadBytes(2);
                @event = new ActionEvent
                {
                    TypeOfAction = actionType,
                    ObjectIndex  = objectIndex,
                    Value        = value,
                    Unknown1     = unknown1,
                    Unknown2     = unknown2
                };
                break;
            }

            case EventType.Dice100Roll:
            {
                var chance = dataReader.ReadByte();
                var unused = dataReader.ReadBytes(6);
                var jumpToIfNotFulfilled = dataReader.ReadWord();
                @event = new Dice100RollEvent
                {
                    Chance = chance,
                    Unused = unused,
                    ContinueIfFalseWithMapEventIndex = jumpToIfNotFulfilled
                };
                break;
            }

            case EventType.Conversation:
            {
                var interaction = (ConversationEvent.InteractionType)dataReader.ReadByte();
                var unused1     = dataReader.ReadBytes(4); // unused
                var value       = dataReader.ReadWord();
                var unused2     = dataReader.ReadBytes(2); // unused
                @event = new ConversationEvent
                {
                    Interaction = interaction,
                    Value       = value,
                    Unused1     = unused1,
                    Unused2     = unused2
                };
                break;
            }

            case EventType.PrintText:
            {
                var npcTextIndex = dataReader.ReadByte();
                var unused       = dataReader.ReadBytes(8); // unused
                @event = new PrintTextEvent
                {
                    NPCTextIndex = npcTextIndex,
                    Unused       = unused
                };
                break;
            }

            case EventType.Create:
            {
                var createType = (CreateEvent.CreateType)dataReader.ReadByte();
                var unused     = dataReader.ReadBytes(4);
                var amount     = dataReader.ReadWord();
                var itemIndex  = dataReader.ReadWord();
                @event = new CreateEvent
                {
                    TypeOfCreation = createType,
                    Unused         = unused,
                    Amount         = amount,
                    ItemIndex      = itemIndex
                };
                break;
            }

            case EventType.Decision:
            {
                var textIndex    = dataReader.ReadByte();
                var unknown1     = dataReader.ReadBytes(6);
                var noEventIndex = dataReader.ReadWord();
                @event = new DecisionEvent
                {
                    TextIndex    = textIndex,
                    NoEventIndex = noEventIndex,
                    Unknown1     = unknown1
                };
                break;
            }

            case EventType.ChangeMusic:
            {
                var musicIndex = dataReader.ReadWord();
                var volume     = dataReader.ReadByte();
                var unknown1   = dataReader.ReadBytes(6);
                @event = new ChangeMusicEvent
                {
                    MusicIndex = musicIndex,
                    Volume     = volume,
                    Unknown1   = unknown1
                };
                break;
            }

            case EventType.Exit:
            {
                @event = new ExitEvent
                {
                    Unused = dataReader.ReadBytes(9)
                };
                break;
            }

            case EventType.Spawn:
            {
                // byte0: x
                // byte1: y
                // byte2: travel type (see TravelType)
                // byte3-4: unused?
                // byte5-6: map index
                // byte7-8: unused?
                var x          = dataReader.ReadByte();
                var y          = dataReader.ReadByte();
                var travelType = (TravelType)dataReader.ReadByte();
                var unknown1   = dataReader.ReadBytes(2);   // unknown
                var mapIndex   = dataReader.ReadWord();
                var unknown2   = dataReader.ReadBytes(2);   // unknown
                @event = new SpawnEvent
                {
                    X          = x,
                    Y          = y,
                    TravelType = travelType,
                    Unknown1   = unknown1,
                    MapIndex   = mapIndex,
                    Unknown2   = unknown2
                };
                break;
            }

            case EventType.Interact:
            {
                @event = new InteractEvent
                {
                    Unused = dataReader.ReadBytes(9)
                };
                break;
            }

            default:
            {
                @event = new DebugEvent
                {
                    Data = dataReader.ReadBytes(9)
                };
                break;
            }
            }

            @event.Type = type;

            return(@event);
        }
示例#26
0
 public void OnDoorUse(Fougerite.Player player, DoorEvent evt)
 {
     this.Invoke("On_DoorUse", new object[] { player, evt });
 }
示例#27
0
 void DoorUse(Fougerite.Player p, DoorEvent de)
 {
 }
示例#28
0
        static EventBase GetFakeEvent()
        {
            var selector = Faker.NumberFaker.Number(0, 5);

            switch (selector)
            {
            case 0:
                var e = new DoorEvent
                {
                    Eventno   = count++,
                    EventType = DoorEventEventType.DoorEvent,
                    Doors     = new DoorsSchema
                    {
                        Event = count++,
                        Left  = new Doorpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Open  = Faker.BooleanFaker.Boolean()
                        },
                        Right = new Doorpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Open  = Faker.BooleanFaker.Boolean()
                        }
                    }
                };
                return(e);

            case 1:
                var le = new LightEvent
                {
                    Eventno   = count++,
                    EventType = LightEventEventType.LightEvent,
                    Lights    = new LightsSchema
                    {
                        Event     = Faker.NumberFaker.Number(0, 11),
                        Frontpass = Faker.BooleanFaker.Boolean(),
                        Rearpass  = Faker.BooleanFaker.Boolean(),
                        Left      = new Lightpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Lit   = Faker.BooleanFaker.Boolean()
                        },
                        Right = new Lightpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Lit   = Faker.BooleanFaker.Boolean()
                        },
                        Rear = new Lightpos
                        {
                            Count = Faker.NumberFaker.Number(0, 65000),
                            Lit   = Faker.BooleanFaker.Boolean()
                        }
                    }
                };
                return(le);

            case 2:
                var re = new RelocatedEvent
                {
                    EventType = RelocatedEventEventType.RelocatedEvent,
                    Location  = GetFakeLocation()
                };
                return(re);

            case 3:
                var pe = new PowerEvent
                {
                    EventType = PowerEventEventType.PowerEvent,
                    Msg       = Faker.TextFaker.Sentence()
                };
                return(pe);

            case 4:
                var ce = new CommEvent
                {
                    EventType = CommEventEventType.CommEventSuccess,
                    Conncount = count++,
                    Humidity  = Faker.NumberFaker.Number(0, 100),
                    Tempf     = Faker.NumberFaker.Number(0, 100),
                    Msgnum    = count,
                    Msg       = Faker.TextFaker.Sentence()
                };
                return(ce);

            case 5:
                var cee = new CommEvent
                {
                    EventType = CommEventEventType.CommEventError,
                    Conncount = count++,
                    Humidity  = Faker.NumberFaker.Number(0, 100),
                    Tempf     = Faker.NumberFaker.Number(0, 100),
                    Msgnum    = count,
                    Msg       = Faker.TextFaker.Sentence()
                };
                return(cee);

            default:
                return(null);
            }
        }
示例#29
0
 public void OnDoorUse(Player player, DoorEvent evt)
 {
     Invoke("On_DoorUse", player, evt);
 }
示例#30
0
 protected virtual void OnDoorChanged(DoorEventArgs e)
 {
     DoorEvent?.Invoke(this, e);
 }