コード例 #1
0
ファイル: FurniInteractor.cs プロジェクト: BjkGkh/07052014
 internal override void OnPlace(GameClient Session, RoomItem Item)
 {
     Room room = Item.GetRoom();
     switch (Item.GetBaseItem().InteractionType)
     {
         case InteractionType.triggerroomenter:
             {
                 IWiredTrigger handler = new EntersRoom(Item, room.GetWiredHandler(), room.GetRoomUserManager(), false, string.Empty);
                 using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
                     handler.LoadFromDatabase(dbClient, room);
                 break;
             }
         case InteractionType.triggergameend:
             {
                 IWiredTrigger handler = new GameEnds(Item, room.GetWiredHandler(), room.GetGameManager());
                 using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
                     handler.LoadFromDatabase(dbClient, room);
                 break;
             }
         case InteractionType.triggergamestart:
             {
                 IWiredTrigger handler = new GameStarts(Item, room.GetWiredHandler(), room.GetGameManager());
                 using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
                     handler.LoadFromDatabase(dbClient, room);
                 break;
             }
         case InteractionType.triggerrepeater:
             {
                 IWiredTrigger handler = new Repeater(room.GetWiredHandler(), Item, 5000);
                 using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().getQueryreactor())
                     handler.LoadFromDatabase(dbClient, room);
             }
             break;
     }
 }
コード例 #2
0
ファイル: WiredLoader.cs プロジェクト: BjkGkh/Custom-R2
        internal static void LoadWiredItem(RoomItem item, Room room, IQueryAdapter dbClient)
        {
            InteractionType type = item.GetBaseItem().InteractionType;
            switch (type)
            {
                case InteractionType.actiongivescore:
                    {
                        IWiredTrigger action = new GiveScore(0, 0, room.GetGameManager(), item.Id);
                        action.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.actionmoverotate:
                    {
                        IWiredTrigger action = new MoveRotate(MovementState.none, RotationState.none,new List<RoomItem>(), 0, room, room.GetWiredHandler(), item);
                        action.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.actionposreset:
                    {
                        IWiredTrigger action = new PositionReset(new List<RoomItem>(), 0, room.GetRoomItemHandler(), room.GetWiredHandler(), item.Id, 0,0,0);
                        action.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.actionresettimer:
                    {
                        IWiredTrigger action = new TimerReset(room, room.GetWiredHandler(), new List<RoomItem>(), 0, item.Id);
                        action.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.actionshowmessage:
                    {
                        IWiredTrigger action = new ShowMessage(string.Empty, room.GetWiredHandler(), item.Id);
                        action.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.actionteleportto:
                    {
                        IWiredTrigger action = new TeleportToItem(room.GetGameMap(), room.GetWiredHandler(), new List<RoomItem>(), 0, item.Id);
                        action.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.actiontogglestate:
                    {
                        IWiredTrigger action = new ToggleItemState(room.GetGameMap(), room.GetWiredHandler(), new List<RoomItem>(), 0, item);
                        action.LoadFromDatabase(dbClient, room);
                        //item.wiredHandler = action;
                        HandleItemLoad(action, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.conditionfurnishaveusers:
                    {
                        IWiredCondition furniHasUsers = new FurniHasUser(item, new List<RoomItem>());
                        furniHasUsers.LoadFromDatabase(dbClient, room);
                        HandleConditionLoad(furniHasUsers, item);
                        break;
                    }

                case InteractionType.conditionfurnihasfurni:
                    {
                        IWiredCondition furnihasfurni = new FurniHasFurni(item, new List<RoomItem>());
                        furnihasfurni.LoadFromDatabase(dbClient, room);
                        HandleConditionLoad(furnihasfurni, item);
                        break;
                    }

                case InteractionType.conditionstatepos:
                    {
                        IWiredCondition furnistatepos = new FurniStatePosMatch(item, new List<RoomItem>());
                        furnistatepos.LoadFromDatabase(dbClient, room);
                        HandleConditionLoad(furnistatepos, item);
                        break;
                    }

                case InteractionType.conditiontimelessthan:
                    {
                        IWiredCondition timeLessThan = new LessThanTimer(0, room, item);
                        timeLessThan.LoadFromDatabase(dbClient, room);
                        HandleConditionLoad(timeLessThan, item);
                        break;
                    }

                case InteractionType.conditiontimemorethan:
                    {
                        IWiredCondition timeMoreThan = new MoreThanTimer(0, room, item);
                        timeMoreThan.LoadFromDatabase(dbClient, room);
                        HandleConditionLoad(timeMoreThan, item);
                        break;
                    }

                case InteractionType.conditiontriggeronfurni:
                    {
                        IWiredCondition triggerOnFurni = new TriggerUserIsOnFurni(item, new List<RoomItem>());
                        triggerOnFurni.LoadFromDatabase(dbClient, room);
                        HandleConditionLoad(triggerOnFurni, item);
                        break;
                    }

                case InteractionType.specialrandom:
                    {

                        break;
                    }

                case InteractionType.specialunseen:
                    {

                        break;
                    }

                case InteractionType.triggergameend:
                    {
                        IWiredTrigger handler = new GameEnds(item, room.GetWiredHandler(), room.GetGameManager());
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggergamestart:
                    {
                        IWiredTrigger handler = new GameStarts(item, room.GetWiredHandler(), room.GetGameManager());
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggeronusersay:
                    {
                        IWiredTrigger handler = new UserSays(item, room.GetWiredHandler(), false, string.Empty, room);
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggerrepeater:
                    {
                        IWiredTrigger handler = new Repeater(room.GetWiredHandler(), item, 1);
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggerroomenter:
                    {
                        IWiredTrigger handler = new EntersRoom(item, room.GetWiredHandler(), room.GetRoomUserManager(), false, string.Empty);
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggerscoreachieved:
                    {
                        IWiredTrigger handler = new ScoreAchieved(item, room.GetWiredHandler(), 0, room.GetGameManager());
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggertimer:
                    {
                        IWiredTrigger handler = new Timer(item, room.GetWiredHandler(), 0, room.GetGameManager());
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggerstatechanged:
                    {
                        IWiredTrigger handler = new StateChanged(room.GetWiredHandler(), item, new List<RoomItem>(), 0);
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggerwalkofffurni:
                    {
                        IWiredTrigger handler = new WalksOffFurni(item, room.GetWiredHandler(), new List<RoomItem>(), 0);
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }

                case InteractionType.triggerwalkonfurni:
                    {
                        IWiredTrigger handler = new WalksOnFurni(item, room.GetWiredHandler(), new List<RoomItem>(), 0);
                        handler.LoadFromDatabase(dbClient, room);
                        HandleItemLoad(handler, room.GetWiredHandler(), item);
                        break;
                    }
            }
        }