Esempio n. 1
0
        public static void Load()
        {
            ReflectionConstructor <Story> .Register("Story");

            ReflectionConstructor <Character> .Register("Character");

            ReflectionConstructor <Item> .Register("Item");

            ReflectionConstructor <History> .Register("History");

            ReflectionConstructor <Journey> .Register("Journey");

            ReflectionConstructor <Variable> .Register("Variable");

            ReflectionConstructor <City> .Register("City");

            ReflectionConstructor <Location> .Register("Location");

            ReflectionConstructor <LocationScenario> .Register("Scene");

            ReflectionConstructor <LocationScenario> .Register("LocationScenario");

            ReflectionConstructor <JourneyScenario> .Register("JourneyScenario");

            ReflectionConstructor <Page> .Register("Page");

            ReflectionConstructor <Actor> .Register("ScenarioActor");

            ReflectionConstructor <Objective> .Register("Objective");

            ReflectionConstructor <Alignment> .Register("Alignment");

            ReflectionConstructor <Point2D> .Register("Point2D");

            ReflectionConstructor <ConditionOutcome> .Register("Condition");

            ReflectionConstructor <ConditionOutcome> .Register("ConditionOutcome");

            ReflectionConstructor <GlobalEvent> .Register("GlobalEvent");

            ReflectionConstructor <TestResources> .Register("TestResources");

            ReflectionConstructor <Skill> .Register("Skill");

            ReflectionConstructor <Clue> .Register("Clue");

            Condition.Register();
            GameValue.Register();
            StoryEvent.Load();
        }
Esempio n. 2
0
        private StoryEvent compileTrades(List <Trade> trades, bool buying, StoryEvent restart)
        {
            TextChoiceEvent choiceEvent = new TextChoiceEvent();

            choiceEvent.prompt = "What would you like to " + (buying ? "buy" : "sell") + "?";

            foreach (Trade trade in trades)
            {
                Choice choice = new Choice();
                choice.text = trade.MakeChoice(buying);
                choice.conditions.Add(trade.MakeCondition(buying));
                choiceEvent.choices.Add(choice);

                IfEvent checkQuantity = new IfEvent();
                choice.outcomeEvents.Add(checkQuantity);

                ConditionOutcome limitReachedOutcome = new ConditionOutcome();
                limitReachedOutcome.condition1      = new CanTradeCondition(trade, true);
                limitReachedOutcome.nextEvent.Value = choiceEvent;
                checkQuantity.outcomes.Add(limitReachedOutcome);

                TextEvent soldOut = new TextEvent();
                soldOut.speaker.Value = speaker;
                soldOut.text          = buying ? "I'm sorry, I'm all sold out of that." : "I'm sorry, I think I have enough of that.";
                if (trades.Count > 1)
                {
                    soldOut.text += " Maybe something else?";
                }
                limitReachedOutcome.outcomeEvents.Add(soldOut);

                ConditionOutcome enoughOutcome = new ConditionOutcome();
                enoughOutcome.condition1 = new CanTradeCondition(trade, false);
                checkQuantity.outcomes.Add(enoughOutcome);

                TextChoiceEvent tradeChoice = new TextChoiceEvent();
                tradeChoice.prompt = trade.prompt;
                enoughOutcome.outcomeEvents.Add(tradeChoice);

                Choice accept = new Choice();
                accept.text = trade.acceptResponse;
                tradeChoice.choices.Add(accept);

                accept.outcomeEvents.AddRange(trade.MakeOutcomes(buying));
                if (!String.IsNullOrEmpty(thanks))
                {
                    TextEvent acceptMessage = new TextEvent();
                    acceptMessage.text          = thanks;
                    acceptMessage.speaker.Value = speaker;
                    accept.outcomeEvents.Add(acceptMessage);
                }
                accept.nextEvent.Value = choiceEvent;

                Choice decline = new Choice();
                decline.text = trade.declineResponse;
                tradeChoice.choices.Add(decline);

                Choice backToTrade = new Choice();
                backToTrade.text            = "Maybe another item...";
                backToTrade.nextEvent.Value = choiceEvent;
                tradeChoice.choices.Add(backToTrade);
            }

            Choice back = new Choice();

            back.text = "On second thought, nevermind.";
            choiceEvent.choices.Add(back);

            return(choiceEvent);
        }