예제 #1
0
    public object Clone()
    {
        AdventureData ad = (AdventureData)base.Clone();

        ad.buttons = new List <CustomButton>();
        foreach (CustomButton cb in buttons)
        {
            ad.buttons.Add((CustomButton)cb.Clone());
        }
        foreach (CustomArrow ca in arrows)
        {
            ad.arrows.Add((CustomArrow)ca.Clone());
        }
        //ad.chapters = new List<Chapter>();
        //for (Chapter c : chapters)
        //	ad.chapters.Add((Chapter) c.Clone());
        ad.commentaries = commentaries;
        ad.contents     = new List <ChapterSummary>();
        foreach (ChapterSummary cs in contents)
        {
            ad.contents.Add((ChapterSummary)cs.Clone());
        }
        ad.cursors = new List <CustomCursor>();
        foreach (CustomCursor cc in cursors)
        {
            ad.cursors.Add((CustomCursor)cc.Clone());
        }
        ad.description   = description;
        ad.guiCustomized = guiCustomized;
        ad.guiType       = guiType;
        ad.playerMode    = playerMode;
        ad.playerName    = (playerName != null ? playerName : null);
        ad.title         = (title != null ? title : null);
        return(ad);
    }
예제 #2
0
 public SelectCursorPathTool(AdventureData adventureData, int t)
     : base(createResources(adventureData, t), createAssetInfoArray(t), Controller.ACTION_CUSTOM, 0)
 {
     this.adventureData = adventureData;
     this.t             = t;
     this.type          = DescriptorData.getCursorTypeString(t);
 }
예제 #3
0
    public void StartAdventure(int pupilId)
    {
        var data = new AdventureData();

        data.PupilId = pupilId;
        Data         = data;
    }
        public static AdventureData GetDefaultAdventure1()
        {
            var adventureData = new AdventureData {
                Name     = "Adventure1",
                Triggers = new BaseTriggerData[] {
                    new TextTriggerData {
                        Name = "StartTile",
                        Text = "Life is normally difficult in the Underdark, but the spider goddess Lolth's demand for your sacrifice has made it impossible. You are left with one choice: You must fight your way through the Underdark and find your way to the surface."
                    },
                    new TextTriggerData {
                        Name = "SurfaceHollow",
                        Text = "The sound of running water is a welcome respite from the silence of the caves. After days of traveling through the dark, you see the soft glow of sunlight ahead. Only a few monsters stand between you and freedom!"
                    },
                    new PlaceDoubleTileTriggerData {
                        Name           = "UndergroundRiver",
                        DoubleTileName = "SurfaceHollow",
                        TileToAttach   = "UndergroundRiver"
                    }
                },
                WinningCondition = new StandNearSquareConditionData {
                    RelatedTileName = "SurfaceHollow_2",
                    Type            = TerrainTypes.Exit,
                    Distanse        = 1
                }
            };

            return(adventureData);
        }
예제 #5
0
 public DungeonViewModel(AdventureData d)
 {
     data = d;
     OnPropertyChanged(nameof(AdventureType));
     OnPropertyChanged(nameof(Region));
     OnPropertyChanged(nameof(Size));
     OnPropertyChanged(nameof(PrimaryMonster));
 }
예제 #6
0
 public GameState(AdventureData data)
 {
     this.removedElements = new List <string>();
     this.inventoryItems  = new List <string>();
     this.data            = data;
     varFlags             = new Dictionary <string, int>();
     elementContexts      = new Dictionary <string, List <ElementReference> >();
     varFlagChangeAmbits  = new Stack <List <KeyValuePair <string, int> > >();
 }
예제 #7
0
        public void TestATestAdventureDataBuilder_TestBuild()
        {
            AdventureDataBuilder builder = new AdventureDataBuilder(_inputFilePath);

            builder.Build();
            AdventureData data = builder.GetAdventureData();

            Assert.IsNotNull(data);
        }
예제 #8
0
        public void Build()
        {
            //Deserialize the yaml file that holds the hikers and bridges data
            var deserializer = new DeserializerBuilder()
                               .WithNamingConvention(CamelCaseNamingConvention.Instance)
                               .Build();

            _adventureData = deserializer.Deserialize <AdventureData>(File.OpenText(_inputFilePath));
        }
예제 #9
0
    public GUIProvider(AdventureData data)
    {
        this.guitype = data.getGUIType();


        ResourcesUni auxResource;

        buttons = new Dictionary <int, ResourcesUni> ();

        //We add a resource for each button parsed in descriptor file
        foreach (CustomButton cb in data.getButtons())
        {
            if (buttons.ContainsKey(ActionNameWrapper.IDs [cb.getAction()]))
            {
                buttons [ActionNameWrapper.IDs [cb.getAction()]].addAsset(new Asset(cb.getType(), cb.getPath()));
            }
            else
            {
                auxResource = new ResourcesUni();
                auxResource.addAsset(new Asset(cb.getType(), cb.getPath()));
                buttons.Add(ActionNameWrapper.IDs [cb.getAction()], auxResource);
            }
        }

        //For each button that isn on descriptor file we try to find the default assets;
        Texture2D auxTexture;

        foreach (KeyValuePair <int, string> button in ActionNameWrapper.Names)
        {
            if (!buttons.ContainsKey(button.Key))
            {
                if (DefaultActionAssetWrapper.Assets.ContainsKey(button.Key))
                {
                    string selected = "";
                    foreach (string name in DefaultActionAssetWrapper.Assets[button.Key])
                    {
                        auxTexture = ResourceManager.Instance.getImage(GUIProvider.DEFAULT_ASSET_DIRECTORY + name + ".png");

                        if (auxTexture != null)
                        {
                            selected = name;
                            break;
                        }
                    }

                    if (selected != "")
                    {
                        auxResource = new ResourcesUni();
                        auxResource.addAsset(DescriptorData.NORMAL_BUTTON, GUIProvider.DEFAULT_ASSET_DIRECTORY + selected + ".png");
                        auxResource.addAsset(DescriptorData.HIGHLIGHTED_BUTTON, GUIProvider.DEFAULT_ASSET_DIRECTORY + selected + "Highlighted.png");
                        auxResource.addAsset(DescriptorData.PRESSED_BUTTON, GUIProvider.DEFAULT_ASSET_DIRECTORY + selected + "Pressed.png");
                        buttons.Add(button.Key, auxResource);
                    }
                }
            }
        }
    }
 /**
  * Constructor which creates an adventure data with default title and
  * description, traditional GUI and one empty chapter (with a scene).
  *
  * @param adventureTitle
  *            Default title for the adventure
  * @param chapterTitle
  *            Default title for the chapter
  * @param sceneId
  *            Default identifier for the scene
  */
 public AdventureDataControl(string adventureTitle, string chapterTitle, string sceneId, int playerMode)
 {
     adventureData = new AdventureData();
     adventureData.setTitle(adventureTitle);
     adventureData.setDescription("");
     adventureData.setGUIType(DescriptorData.GUI_CONTEXTUAL);
     adventureData.setPlayerMode(playerMode);
     adventureData.addChapter(new Chapter(chapterTitle, sceneId));
 }
 /**
  * Constructor gith given parameters.
  *
  * @param title
  *            Title of the adventure
  * @param description
  *            Description of the adventure
  * @param guiType
  *            Type of the GUI
  * @param chapters
  *            Chapters of the adventure
  */
 public AdventureDataControl(string title, string description, List <Chapter> chapters)
 {
     adventureData = new AdventureData();
     adventureData.setTitle(title);
     adventureData.setDescription(description);
     adventureData.setGUIType(DescriptorData.GUI_TRADITIONAL);
     adventureData.setChapters(chapters);
     adventureData.setGraphicConfig(DescriptorData.GRAPHICS_WINDOWED);
     adventureData.setPlayerMode(DescriptorData.MODE_PLAYER_3RDPERSON);
 }
예제 #12
0
    /**
     * Constructor.
     *
     * @param zipFile
     *            Path to the zip file which helds the chapter files
     */
    public AdventureHandler(InputStreamCreator isCreator, List <Incidence> incidences)
    {
        this.isCreator  = isCreator;
        assessmentPaths = new List <string>();
        adaptationPaths = new List <string>();
        getXMLFilePaths(isCreator, assessmentPaths, adaptationPaths);

        adventureData   = new AdventureData();
        this.incidences = incidences;
        chapters        = new List <Chapter>();
    }
예제 #13
0
    void Start()
    {
        if (Game.GameToLoad != "")
        {
            gameName    = Game.GameToLoad;
            gamePath    = ResourceManager.Instance.getCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar;
            useSystemIO = true;
        }

        selected_path = gamePath + gameName;
        selected_game = selected_path + "/";

        //Controller.getInstance ().init ("Games/Fire.eap");
        List <Incidence> incidences = new List <Incidence>();

        data = new AdventureData();
        AdventureHandler_ adventure = new AdventureHandler_(data);

        switch (getLoadingType())
        {
        case ResourceManager.LoadingType.RESOURCES_LOAD:
            adventure.Parse(gameName + "/descriptor");
            break;

        case ResourceManager.LoadingType.SYSTEM_IO:
            adventure.Parse(selected_game + "descriptor.xml");
            break;
        }


        /*Texture2DHolder holder = new Texture2DHolder (data.getChapters () [0].getScenes () [0].getResources () [0].getAssetPath (Scene.RESOURCE_TYPE_BACKGROUND));
         *
         * if (!holder.Loaded ())
         *      Debug.Log ("no se ha cargado");*/

        if (data.getCursors().Count == 0)
        {
            loadDefaultCursors();
        }

        guiprovider = new GUIProvider(data);

        if (!forceScene)
        {
            renderScene(data.getChapters()[current_chapter].getInitialGeneralScene().getId());
        }
        else
        {
            renderScene(scene_name);
        }

        TimerController.Instance.Timers = getTimers();
        TimerController.Instance.Run();
    }
예제 #14
0
파일: Game.cs 프로젝트: Victorma/uAdventure
        protected void Awake()
        {
            if (FindObjectsOfType(typeof(Game)).Length > 1)
            {
                Destroy(this.gameObject);
                return;
            }

            DontDestroyOnLoad(this.gameObject);
            DontDestroyOnLoad(Camera.main);

            executeStack = new Stack <KeyValuePair <Interactuable, ExecutionEvent> >();

            skin = Resources.Load("basic") as GUISkin;

            if (!string.IsNullOrEmpty(gamePath))
            {
                ResourceManager = ResourceManagerFactory.CreateExternal(gamePath + gameName);
            }
            else
            {
                if (!string.IsNullOrEmpty(gameName))
                {
                    ResourceManager = ResourceManagerFactory.CreateLocal(gameName, useSystemIO ? ResourceManager.LoadingType.SystemIO : ResourceManager.LoadingType.ResourcesLoad);
                }
                else
                {
                    ResourceManager = ResourceManagerFactory.CreateLocal("CurrentGame/", useSystemIO ? ResourceManager.LoadingType.SystemIO : ResourceManager.LoadingType.ResourcesLoad);
                }
            }

            if (Game.GameToLoad != "")
            {
                gameName    = Game.GameToLoad;
                gamePath    = ResourceManager.getCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar;
                useSystemIO = true;
            }

            AdventureData    data       = new AdventureData();
            var              incidences = new List <Incidence>();
            AdventureHandler adventure  = new AdventureHandler(data, ResourceManager, incidences);

            adventure.Parse("descriptor.xml");

            game_state = new GameState(data);
            bookDrawer = new BookDrawer(ResourceManager);

            gameExtensions = new List <GameExtension>();
            foreach (var gameExtension in GetAllSubclassOf(typeof(GameExtension)))
            {
                gameExtensions.Add(gameObject.AddComponent(gameExtension) as GameExtension);
            }
        }
예제 #15
0
        /**
         * Constructor which creates an adventure data with default title and
         * description, traditional GUI and one empty chapter (with a scene).
         *
         * @param adventureTitle
         *            Default title for the adventure
         * @param chapterTitle
         *            Default title for the chapter
         * @param sceneId
         *            Default identifier for the scene
         */
        public AdventureDataControl(string adventureTitle, string chapterTitle, string sceneId, int playerMode)
        {
            adventureData = new AdventureData();
            adventureData.setTitle(adventureTitle);
            adventureData.setDescription("");
            adventureData.setGUIType(DescriptorData.GUI_CONTEXTUAL);
            adventureData.setPlayerMode(playerMode);
            var chapter = new Chapter(chapterTitle, sceneId);

            chapter.getObjects <Scene>().Add(new Scene(sceneId));
            adventureData.addChapter(chapter);
        }
예제 #16
0
    /// <summary>
    /// 將字典傳入,依json表設定資料
    /// </summary>
    public static void SetData(Dictionary <int, AdventureData> _dic)
    {
        string   jsonStr = Resources.Load <TextAsset>("Json/Adventure").ToString();
        JsonData jd      = JsonMapper.ToObject(jsonStr);
        JsonData items   = jd["Adventure"];

        for (int i = 0; i < items.Count; i++)
        {
            AdventureData armorData = new AdventureData(items[i]);
            int           id        = int.Parse(items[i]["ID"].ToString());
            _dic.Add(id, armorData);
        }
    }
 public GameState(AdventureData data)
 {
     this.removedElements = new List <string>();
     this.inventoryItems  = new List <string>();
     this.data            = data;
     varFlags             = new Dictionary <string, int>();
     elementContexts      = new Dictionary <string, List <ElementReference> >();
     varFlagChangeAmbits  = new Stack <List <KeyValuePair <string, int> > >();
     memories             = new Dictionary <string, Memory>();
     currentChapter       = 0;
     playerContext        = null;
     currentTarget        = data.getChapters()[currentChapter].getInitialChapterTarget().getId();
     lastTarget           = null;
 }
예제 #18
0
    public GUIProvider(AdventureData data)
    {
        this.guitype = data.getGUIType ();
        this.data = data;

        ResourcesUni auxResource;
        buttons = new Dictionary<int, ResourcesUni> ();
        cursores = new Dictionary<string, Texture2D>();

        //We add a resource for each button parsed in descriptor file
        foreach (CustomButton cb in data.getButtons()) {
            if (buttons.ContainsKey (ActionNameWrapper.IDs [cb.getAction ()])) {
                buttons [ActionNameWrapper.IDs [cb.getAction ()]].addAsset (new Asset (cb.getType (), cb.getPath ()));
            }else{
                auxResource = new ResourcesUni ();
                auxResource.addAsset (new Asset (cb.getType (), cb.getPath ()));
                buttons.Add (ActionNameWrapper.IDs [cb.getAction ()], auxResource);
            }
        }

        //For each button that isn on descriptor file we try to find the default assets;
        Texture2D auxTexture;
        foreach (KeyValuePair<int,string> button in ActionNameWrapper.Names) {
            if (!buttons.ContainsKey (button.Key)) {
                if (DefaultActionAssetWrapper.Assets.ContainsKey (button.Key)) {
                    string selected = "";
                    foreach (string name in DefaultActionAssetWrapper.Assets[button.Key]) {
                        auxTexture = ResourceManager.Instance.getImage (GUIProvider.DEFAULT_ASSET_DIRECTORY + name + ".png");

                        if (auxTexture != null) {
                            selected = name;
                            break;
                        }
                    }

                    if (selected != "") {
                        auxResource = new ResourcesUni ();
                        auxResource.addAsset (DescriptorData.NORMAL_BUTTON, GUIProvider.DEFAULT_ASSET_DIRECTORY + selected + ".png");
                        auxResource.addAsset (DescriptorData.HIGHLIGHTED_BUTTON, GUIProvider.DEFAULT_ASSET_DIRECTORY + selected + "Highlighted.png");
                        auxResource.addAsset (DescriptorData.PRESSED_BUTTON, GUIProvider.DEFAULT_ASSET_DIRECTORY + selected + "Pressed.png");
                        buttons.Add (button.Key, auxResource);
                    }
                }
            }
        }

        if(data.getCursors().Count == 0)
            loadDefaultCursors ();
    }
예제 #19
0
    /**
     * Loads the adventure data from the given ZIP file.
     *
     * @param zipFile
     *            Path to the zip file which holds the adventure
     * @return The adventure data, null if there was an error
     */
    public static AdventureData loadAdventureData(InputStreamCreator isCreator, List <Incidence> incidences)
    {
        AdventureData adventureDataTemp = null;

        try
        {
            // Set the adventure handler
            AdventureHandler adventureParser = new AdventureHandler(isCreator, incidences);
            //factory.setValidating(false);
            //SAXParser saxParser = factory.newSAXParser();

            // Read and close the input stream
            string descriptorIS = isCreator.buildInputStream("descriptor.xml");
            adventureParser.Parse(descriptorIS);
            //descriptorIS.close();

            // Load the assessment and adaptation profiles. It must be after parse
            // the adventure data because the profile's load from xml inserts each profile
            // in each chapter.
            adventureParser.loadProfiles();
            // Store the adventure data
            adventureDataTemp = adventureParser.getAdventureData();
        }
        catch (Exception e) { Debug.LogError(e); }
        //catch (ParserConfigurationException e)
        //{
        //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.SAX"), e));
        //}
        //catch (SAXException e)
        //{
        //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.SAX"), e));
        //}
        //catch (IOException e)
        //{
        //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.IO"), e));
        //}
        //catch (IllegalArgumentException e)
        //{
        //    incidences.add(Incidence.createDescriptorIncidence(Language.GetText("Error.LoadDescriptor.NoDescriptor"), e));
        //}

        return(adventureDataTemp);
    }
예제 #20
0
    /// <summary>
    /// Reads the adventures json and stores them into text assets.
    /// </summary>
    List <Adventure> ReadAdventures()
    {
        AdventureData loadedData = new AdventureData();
        string        filePath   = Path.Combine(Application.streamingAssetsPath, "Adventures.json");

        Debug.Log("Path:" + filePath);
        if (File.Exists(filePath))
        {
            string dataAsJson = File.ReadAllText(filePath);
            loadedData = JsonUtility.FromJson <AdventureData>(dataAsJson);
        }
        else
        {
            Debug.LogError("Cannot find file!");
        }

        Debug.Log(loadedData.adventures.Length);

        return(loadedData.ConvertToAdventure());
    }
예제 #21
0
    static byte NextEvent;                             //下一個事件索引

    /// <summary>
    /// 初始化
    /// </summary>
    public void Init(AdventureData _adventure, MilestoneEvent[] _events, int[] _eventMiles, bool[] _unknownEvents)
    {
        MyAdventure = _adventure;
        RTransfrom  = transform.GetComponent <RectTransform>();
        RTransfrom.anchoredPosition = StartPos;
        NextEvent     = 1;
        Events        = _events;
        EventMiles    = _eventMiles;
        UnknownEvents = _unknownEvents;
        EventCount    = (byte)_events.Length;
        if (EventMiles.Length != EventCount || UnknownEvents.Length != EventCount || _unknownEvents.Length == 0)
        {
            Debug.LogWarning("傳入的事件數量錯誤");
            return;
        }
        SpawnMilestone();
        //里程設定
        Mile    = 0;
        MaxMIle = EventMiles[EventCount - 1];
    }
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(AdventureData _adventure, MilestoneEvent[] _events, int[] _eventMiles, bool[] _unknownEvents)
 {
     MyAdventure = _adventure;
     RTransfrom = transform.GetComponent<RectTransform>();
     RTransfrom.anchoredPosition = StartPos;
     NextEvent = 1;
     Events = _events;
     EventMiles = _eventMiles;
     UnknownEvents = _unknownEvents;
     EventCount = (byte)_events.Length;
     if (EventMiles.Length != EventCount || UnknownEvents.Length != EventCount || _unknownEvents.Length == 0)
     {
         Debug.LogWarning("傳入的事件數量錯誤");
         return;
     }
     SpawnMilestone();
     //里程設定
     Mile = 0;
     MaxMIle = EventMiles[EventCount - 1];
 }
예제 #23
0
    protected static ResourcesUni createResources(AdventureData adventureData, string type)
    {
        ResourcesUni resources  = new ResourcesUni();
        bool         introduced = false;

        for (int i = 0; i < adventureData.getArrows().Count; i++)
        {
            CustomArrow customArrow = adventureData.getArrows()[i];
            if (customArrow.getType().Equals(type))
            {
                resources.addAsset(type, customArrow.getPath());
                introduced = true;
                break;
            }
        }

        if (!introduced)
        {
            resources.addAsset(type, null);
        }

        return(resources);
    }
예제 #24
0
        protected static ResourcesUni createResources(AdventureData adventureData, string action, string type)
        {
            ResourcesUni resources  = new ResourcesUni();
            bool         introduced = false;

            for (int i = 0; i < adventureData.getButtons().Count; i++)
            {
                CustomButton customButton = adventureData.getButtons()[i];
                if (customButton.getType().Equals(type) && customButton.getAction().Equals(action))
                {
                    resources.addAsset(action + "#" + type, customButton.getPath());
                    introduced = true;
                    break;
                }
            }

            if (!introduced)
            {
                resources.addAsset(action + "#" + type, /*"NULL"*/ null);
            }

            return(resources);
        }
예제 #25
0
        protected static ResourcesUni createResources(AdventureData adventureData, int t)
        {
            string       type       = DescriptorData.getCursorTypeString(t);
            ResourcesUni resources  = new ResourcesUni();
            bool         introduced = false;

            for (int i = 0; i < adventureData.getCursors().Count; i++)
            {
                if (adventureData.getCursors()[i].getType().Equals(type) && adventureData.getCursors()[i].getPath() != null)
                {
                    resources.addAsset(type, adventureData.getCursors()[i].getPath());
                    introduced = true;
                    break;
                }
            }

            if (!introduced)
            {
                resources.addAsset(type, null);
            }

            return(resources);
        }
예제 #26
0
    void Awake()
    {
        Game.instance = this;
        style         = Resources.Load("basic") as GUISkin;
        optionlabel   = new GUIStyle(style.label);

        if (Game.GameToLoad != "")
        {
            gameName    = Game.GameToLoad;
            gamePath    = ResourceManager.Instance.getCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar;
            useSystemIO = true;
        }

        selected_path = gamePath + gameName;
        selected_game = selected_path + "/";

        List <Incidence> incidences = new List <Incidence>();

        AdventureData     data      = new AdventureData();
        AdventureHandler_ adventure = new AdventureHandler_(data);

        switch (getLoadingType())
        {
        case ResourceManager.LoadingType.RESOURCES_LOAD:
            adventure.Parse(gameName + "/descriptor");
            ResourceManager.Instance.Path = gameName;
            break;

        case ResourceManager.LoadingType.SYSTEM_IO:
            adventure.Parse(selected_game + "descriptor.xml");
            ResourceManager.Instance.Path = selected_game;
            break;
        }

        game_state = new GameState(data);
    }
예제 #27
0
 public DeleteCursorTool(AdventureData adventureData, int index)
 {
     this.adventureData = adventureData;
     this.index         = index;
 }
예제 #28
0
 public SelectArrowTool(AdventureData adventureData, string type) : base(createResources(adventureData, type), createAssetInfoArray(type), Controller.RESOURCES, 0)
 {
     this.adventureData = adventureData;
     this.type          = type;
 }
예제 #29
0
        void Awake()
        {
            Game.instance = this;
            //Load tracker data
            SimpleJSON.JSONNode hostfile = new SimpleJSON.JSONClass();
            bool loaded = false;

#if UNITY_WEBPLAYER || UNITY_WEBGL
#elif UNITY_ANDROID || UNITY_IPHONE
#else
            if (useSystemIO)
            {
                if (!System.IO.File.Exists("host.cfg"))
                {
                    hostfile.Add("host", new SimpleJSON.JSONData("http://192.168.175.117:3000/api/proxy/gleaner/collector/"));
                    hostfile.Add("trackingCode", new SimpleJSON.JSONData("57d81d5585b094006eab04d6ndecvjlvjss8aor"));
                    System.IO.File.WriteAllText("host.cfg", hostfile.ToString());
                }
                else
                {
                    hostfile = SimpleJSON.JSON.Parse(System.IO.File.ReadAllText("host.cfg"));
                }
                loaded = true;
            }
#endif
            try
            {
                if (loaded)
                {
                    Tracker.T.host         = hostfile["host"];
                    Tracker.T.trackingCode = hostfile["trackingCode"];
                    //End tracker data loading
                }
            }
            catch { }

            style       = Resources.Load("basic") as GUISkin;
            optionlabel = new GUIStyle(style.label);

            if (Game.GameToLoad != "")
            {
                gameName    = Game.GameToLoad;
                gamePath    = ResourceManager.Instance.getCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar;
                useSystemIO = true;
            }

            if (editor_mode)
            {
                gameName = "CurrentGame";
            }

            selected_path = gamePath + gameName;
            selected_game = selected_path + "/";

            // TODO incidences are unused, why?
            //List<Incidence> incidences = new List<Incidence>();

            AdventureData     data      = new AdventureData();
            AdventureHandler_ adventure = new AdventureHandler_(data);
            switch (getLoadingType())
            {
            case ResourceManager.LoadingType.RESOURCES_LOAD:
                adventure.Parse(gameName + "/descriptor");
                ResourceManager.Instance.Path = gameName;
                break;

            case ResourceManager.LoadingType.SYSTEM_IO:
                adventure.Parse(selected_game + "descriptor.xml");
                ResourceManager.Instance.Path = selected_game;
                break;
            }

            game_state = new GameState(data);
            CompletableController.Instance.setCompletables(GameState.getCompletables());
        }
예제 #30
0
    /**
     * Constructor.
     *
     * @param zipFile
     *            Path to the zip file which helds the chapter files
     */
    public AdventureHandler(InputStreamCreator isCreator, List<Incidence> incidences)
    {
        this.isCreator = isCreator;
        assessmentPaths = new List<string>();
        adaptationPaths = new List<string>();
        getXMLFilePaths(isCreator, assessmentPaths, adaptationPaths);

        adventureData = new AdventureData();
        this.incidences = incidences;
        chapters = new List<Chapter>();
    }
예제 #31
0
 public GameState(AdventureData data)
 {
     this.data = data;
 }
예제 #32
0
 public GameState(AdventureData data)
 {
     this.data = data;
     flags = new Dictionary<string, int>();
     variables = new Dictionary<string, int>();
 }
 /**
  * Constructor.
  *
  * @param zipFile
  *            Path to the zip file which helds the chapter files
  */
 public AdventureHandler_(AdventureData adventuredata)
 {
     adventureData = adventuredata;
     chapters = new List<Chapter>();
 }
        ///**
        // * Controller for LOM data (only required when exporting games to LOM)
        // */
        //private LOMDataControl lomController;

        ///**
        // * Controller for IMS data (only required when exporting games to SCORM)
        // */
        //private IMSDataControl imsController;

        ///**
        // * Controller for LOM-ES data (require to export games as ODE)
        // */
        //private LOMESDataControl lomesController;

        /**
         * Assessment file data controller
         */
        //private AssessmentProfilesDataControl assessmentProfilesDataControl;

        /**
         * Adaptation file data controller
         */
        //private AdaptationProfilesDataControl adaptationProfilesDataControl;

        /**
         * Constructs the data control with the adventureData
         */
        public AdventureDataControl(AdventureData data) : this()
        {
            adventureData = data;
            checkContextualButtons();
        }
 /**
  * Empty constructor. Sets all values to null.
  */
 public AdventureDataControl()
 {
     adventureData = new AdventureData();
 }
예제 #36
0
 /// <summary>
 /// 將字典傳入,依json表設定資料
 /// </summary>
 public static void SetData(Dictionary<int, AdventureData> _dic)
 {
     string jsonStr = Resources.Load<TextAsset>("Json/Adventure").ToString();
     JsonData jd = JsonMapper.ToObject(jsonStr);
     JsonData items = jd["Adventure"];
     for (int i = 0; i < items.Count; i++)
     {
         AdventureData armorData = new AdventureData(items[i]);
         int id = int.Parse(items[i]["ID"].ToString());
         _dic.Add(id, armorData);
     }
 }
예제 #37
0
 /**
  * @param adventureData
  *            the adventureData to set
  */
 public static void setAdventureData(AdventureData adventureData)
 {
     Loader.adventureData = adventureData;
 }
예제 #38
0
    void Awake()
    {
        Game.instance = this;
        style = Resources.Load("basic") as GUISkin;
        optionlabel = new GUIStyle(style.label);

        if (Game.GameToLoad != "") {
            gameName = Game.GameToLoad;
            gamePath = ResourceManager.Instance.getCurrentDirectory () + System.IO.Path.DirectorySeparatorChar + "Games" + System.IO.Path.DirectorySeparatorChar;
            useSystemIO = true;
        }

        selected_path = gamePath + gameName;
        selected_game = selected_path + "/";

        List<Incidence> incidences = new List<Incidence>();

        AdventureData data = new AdventureData ();
        AdventureHandler_ adventure = new AdventureHandler_ (data);
        switch (getLoadingType ()) {
        case ResourceManager.LoadingType.RESOURCES_LOAD:
            adventure.Parse (gameName + "/descriptor");
            ResourceManager.Instance.Path = gameName;
            break;
        case ResourceManager.LoadingType.SYSTEM_IO:
            adventure.Parse (selected_game + "descriptor.xml");
            ResourceManager.Instance.Path = selected_game;
            break;
        }

        game_state = new GameState(data);
    }