Exemplo n.º 1
0
        public void Initialise()
        {
            Root = new Root();
            ConfigFile cf = new ConfigFile();
            cf.Load("Resources.cfg", "\t:=", true);

            ConfigFile.SectionIterator seci = cf.GetSectionIterator();

            while (seci.MoveNext())
            {
                ConfigFile.SettingsMultiMap settings = seci.Current;
                foreach (KeyValuePair<string, string> pair in settings)
                    ResourceGroupManager.Singleton.AddResourceLocation(pair.Value, pair.Key, seci.CurrentKey);
            }

            if (!Root.RestoreConfig())
                if (!Root.ShowConfigDialog())
                    return;

            Root.RenderSystem.SetConfigOption("VSync", "Yes");
            RenderWindow = Root.Initialise(true, "Kolejny epicki erpeg");  // @@@@@@@@@@@@@@@ Nazwa okna gry.

            ResourceGroupManager.Singleton.InitialiseAllResourceGroups();

            SceneManager = Root.CreateSceneManager(SceneType.ST_GENERIC);
            Camera = SceneManager.CreateCamera("MainCamera");
            Viewport = RenderWindow.AddViewport(Camera);
            Camera.NearClipDistance = 0.1f;
            Camera.FarClipDistance = 1000.0f;
            Camera.AspectRatio = ((float)RenderWindow.Width / (float)RenderWindow.Height);

            MOIS.ParamList pl = new MOIS.ParamList();
            IntPtr windowHnd;
            RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
            pl.Insert("WINDOW", windowHnd.ToString());

            InputManager = MOIS.InputManager.CreateInputSystem(pl);

            Keyboard = (MOIS.Keyboard)InputManager.CreateInputObject(MOIS.Type.OISKeyboard, true);
            Mouse = (MOIS.Mouse)InputManager.CreateInputObject(MOIS.Type.OISMouse, true);

            NewtonWorld = new World();
            NewtonDebugger = new Debugger(NewtonWorld);
            NewtonDebugger.Init(SceneManager);

            GameCamera = new GameCamera();
            ObjectManager = new ObjectManager();

            MaterialManager = new MaterialManager();
            MaterialManager.Initialise();

            Items = new Items();
            PrizeManager = new PrizeManager();  //////////////////// @@ Brand nju staff. Nawet trochę działa :Δ
            CharacterProfileManager = new CharacterProfileManager();
            Quests = new Quests();
            NPCManager = new NPCManager();

            Labeler = new TextLabeler(5);
            Random = new Random();
            HumanController = new HumanController();

            TypedInput = new TypedInput();

            SoundManager = new SoundManager();

            Dialog = new Dialog();
            Mysz = new MOIS.MouseState_NativePtr();
            Conversations = new Conversations();

            TriggerManager = new TriggerManager();

            Engine.Singleton.Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(TypedInput.onKeyPressed);
            Mouse.MouseReleased += new MOIS.MouseListener.MouseReleasedHandler(MouseReleased);

            IngameConsole = new IngameConsole();
            IngameConsole.Init();
            IngameConsole.AddCommand("dupa", "soundOddawajPiec");
            IngameConsole.AddCommand("tp", "ZejscieDoPiwnicy");
            IngameConsole.AddCommand("exit", "Exit", "Wychodzi z gry. Ale odkrywcze. Super. Musze sprawdzic jak sie zachowa konsola przy duzej dlugosci linii xD llllllllllllllllllllllllllllllllllllllllllllmmmmmmmmmmmmmmmmmmmmmiiiiiiiiiiiiiiii");
            IngameConsole.AddCommand("play", "playSound", "Odtwarza dzwiek. Skladnia: play <sciezka do pliku>. Np. play other/haa.mp3");
            IngameConsole.AddCommand("map", "ChangeMap");
            IngameConsole.AddCommand("save", "SaveGame");
            IngameConsole.AddCommand("load", "LoadGame");
            IngameConsole.AddCommand("help", "ConsoleHelp");
            IngameConsole.AddCommand("h", "CommandHelp");
        }
Exemplo n.º 2
0
        public Conversations()
        {
            D = new Dictionary<String, Dialog>();

            if (File.Exists("Media\\Others\\Dialogi.xml"))
            {
                XmlDocument File1 = new XmlDocument();
                File1.Load("Media\\Others\\Dialogi.xml");
                XmlElement root = File1.DocumentElement;
                XmlNodeList Items = root.SelectNodes("//Dialogs//Dialog");

                foreach (XmlNode item in Items)
                {
                    Dialog justDialog = new Dialog();

                    XmlNodeList TalkReactions = item["Reactions"].ChildNodes;

                    foreach (XmlNode tr in TalkReactions)
                    {
                        TalkReaction justReaction = new TalkReaction();
                        justDialog.Reactions.Add(tr["TalkReactionID"].InnerText, justReaction);
                    }

                    XmlNodeList TalkReplies = item["Replies"].ChildNodes;

                    foreach (XmlNode rep in TalkReplies)
                    {
                        TalkReply justReply = new TalkReply();
                        justReply.IsEnding = bool.Parse(rep["IsEnding"].InnerText);

                        float dur = float.Parse(rep["Duration"].InnerText);
                        justReply.Text.Add(new TalkText((rep["Text"].InnerText), dur, rep["Sound"].InnerText));

                        if (!justReply.IsEnding)
                            justReply.Reaction = justDialog.Reactions[rep["TalkReaction"].InnerText];

                        justDialog.Replies.Add(rep["TalkReplyID"].InnerText, justReply);
                    }

                    XmlNodeList TalkNodes = item["Nodes"].ChildNodes;

                    foreach (XmlNode tn in TalkNodes)
                    {
                        TalkNode justNode = new TalkNode();

                        float dur = float.Parse(tn["Duration"].InnerText);
                        justNode.Text.Add(new TalkText((tn["Text"].InnerText), dur, tn["Sound"].InnerText));

                        XmlNodeList RepliesInNode = tn["NodeReplies"].ChildNodes;

                        foreach (XmlNode rin in RepliesInNode)
                        {
                            justNode.Replies.Add(justDialog.Replies[rin["ReplyID"].InnerText]);
                        }

                        XmlNodeList ActionsInNode = tn["Actions"].ChildNodes;
                        List<ActionType> actionList = new List<ActionType>();

                        foreach (XmlNode ain in ActionsInNode)
                        {
                            actionList.Add((ActionType)int.Parse(ain["ActionType"].InnerText));
                        }

                        justNode.AddActions(actionList);

                        if (tn["TalkEdges"].ChildNodes.Count > 0)
                        {
                            XmlNodeList nodelist = tn["TalkEdges"].ChildNodes;

                            foreach (XmlNode nod in nodelist)
                                justDialog.EdgesToNodes.Add(nod["TalkEdgeID"].InnerText, tn["TalkNodeID"].InnerText);
                        }

                        justNode.Quest = tn["QuestID"].InnerText;
                        if (tn["PrizeNPC"].InnerText != "")
                            justNode.PrizeNPC = PrizeManager.P[tn["PrizeNPC"].InnerText];

                        if (tn["PrizePlayer"].InnerText != "")
                            justNode.PrizePlayer = PrizeManager.P[tn["PrizePlayer"].InnerText];

                        if (tn["PrizePlayerRemove"].InnerText != "")
                            justNode.PrizePlayerRemove = PrizeManager.P[tn["PrizePlayerRemove"].InnerText];

                        if (tn["Activator"].InnerText != "" && tn["Activator"].InnerText != null)
                            justNode.Activatorr = tn["Activator"].InnerText;
                        else
                            justNode.Activatorr = "";
                        justNode.PrzypiszMetode();
                        justNode.DialogID = item["DialogID"].InnerText;
                        justDialog.Nodes.Add(tn["TalkNodeID"].InnerText, justNode);
                    }

                    XmlNodeList TalkEdges = item["Edges"].ChildNodes;

                    foreach (XmlNode te in TalkEdges)
                    {
                        TalkEdge justEdge = new TalkEdge(justDialog.Nodes[te["ToWhere"].InnerText]);
                        justEdge.ID = te["TalkEdgeID"].InnerText;
                        XmlNodeList ConditionsInEdge = te["Conditions"].ChildNodes;
                        List<Condition> listaWarunkow = new List<Condition>();

                        foreach (XmlNode cin in ConditionsInEdge)
                        {
                            listaWarunkow.Add((Condition)int.Parse(cin["ConditionType"].InnerText));
                        }

                        justEdge.AddConditions(listaWarunkow);

                        while (justDialog.EdgesToNodes.ContainsKey(te["TalkEdgeID"].InnerText))
                        {
                            justDialog.Nodes[justDialog.EdgesToNodes[te["TalkEdgeID"].InnerText]].Edges.Add(justEdge);
                            justDialog.EdgesToNodes.Remove(te["TalkEdgeID"].InnerText);
                        }

                        justEdge.Quest = te["ConditionQuestID"].InnerText;
                        justEdge.AmountGold = int.Parse(te["GoldRequired"].InnerText);

                        justDialog.Edges.Add(te["TalkEdgeID"].InnerText, justEdge);
                        justDialog.Reactions[te["FromWhere"].InnerText].Edges.Add(justDialog.Edges[te["TalkEdgeID"].InnerText]);
                    }

                    justDialog.ID = item["DialogID"].InnerText;
                    D.Add(item["DialogID"].InnerText, justDialog);
                }
            }
        }