Пример #1
0
 static OrderController CreateSeparateServices()
 {
     var reader = new Reader<Order>();
     var saver = new Saver<Order>();
     var deleter = new Deleter<Order>();
     return new OrderController(reader, saver, deleter);
 }
Пример #2
0
    void ReadPeopleData()
    {
        string Data   = Saver.ReadJsonString(Saver.CharacterDataPath); //读取字符串
        Person person = JsonMapper.ToObject <Person>(Data);            //字符串转化为数据

        m_people = person.Persons;
    }
Пример #3
0
    void ReadGunData()
    {
        string  GunData = Saver.ReadJsonString(Saver.GunDataPath);
        Bag_Gun bag_Gun = JsonMapper.ToObject <Bag_Gun>(GunData);

        m_haveGun = bag_Gun.haveGuns;
    }
Пример #4
0
 public void ClearTable()
 {
     Saver.DeleteFile(_saveName);
     _scoreList = new ScoreList();
     Saver.SaveData(_scoreList, _saveName);
     FillTable();
 }
Пример #5
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            if (_upDownAmount.Value == null || _upDownPrice.Value == null)
            {
                return;
            }

            var item = new InvoiceItem
            {
                Name     = _tbName.Text,
                Price    = _upDownPrice.Value.Value,
                Amount   = _upDownAmount.Value.Value,
                Currency = _currency,
                Unit     = _cbUnit.SelectedItem as UnitOfMeasure
            };

            item.SetTotal();

            var result = Saver.Checker(item);

            if (result)
            {
                _items.Add(item);
                Init();
            }
        }
Пример #6
0
 public void Save(Saver saver)
 {
     saver.Header("Button");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.End();
 }
Пример #7
0
        public static void startEvent(PC pc, Balance balance, string event_name = "")
        {
            _pc      = pc;
            _balance = balance;
            if (event_name != "")
            {
            }
            else
            {
                int    event_index  = rnd.Next(0, _events_list.Count);
                string event_string = _events_list[event_index];
                switch (event_string)
                {
                case "GPUBroken":
                    GPUBroken();
                    break;

                case "YouFindAPassport":
                    YouFindAPassport();
                    break;

                default:
                    break;
                }
            }
            Saver.save();
        }
Пример #8
0
 public void Save(Saver saver)
 {
     saver.Header((saveMode) ? "ProfileLevelPack" : "LevelPack");
     if (saveMode) saver.Save(unlockedUpTo, "Unlocked");
     saver.SaveArray<String>(levels.ToArray(), "Levels");
     saver.End();
 }
Пример #9
0
        public void Start()
        {
            while (true)
            {
                try
                {
                    string commands = this.ReadCommands();

                    if (commands.Equals("exit"))
                    {
                        break;
                    }
                    if (string.IsNullOrEmpty(commands)) // checks if its null or if the first element is nullOrEmpty
                    {
                        continue;
                    }

                    this.ProcessCommands(commands);
                    if (loggedUser != null)
                    {
                        Saver.CreateUserFile(loggedUser);
                    }
                    //this.PrintReports(commandResult);
                }
                catch (Exception ex)
                {
                    Writer.WriteLine(ex.Message);
                }
            }
        }
Пример #10
0
    public static void open(int i)
    {
        if (!dict.ContainsKey(i))
        {
            return;
        }

        ContentManager.data.keys -= 1;
        GameObject go = dict[i];

        foreach (Transform child in go.transform)
        {
            if (child.name == "Lock")
            {
                child.gameObject.SetActive(false);
            }
        }

        LootType lt  = random();
        string   slt = lt.ToString().ToLower();

        if (slt.Contains("coins"))
        {
            int n = Int32.Parse(slt.Split('_')[1]);

            GameObject o = GameObject.Instantiate(coins, go.transform);
            o.GetComponentInChildren <Text>().text = "+" + n;

            ContentManager.data.coins += n;
        }
        else if (slt.Contains("energy"))
        {
            int n = Int32.Parse(slt.Split('_')[1]);

            GameObject o = GameObject.Instantiate(energy, go.transform);
            o.GetComponentInChildren <Text>().text = "+" + n;

            if (ContentManager.data.energy + n >= ContentManager.data.energy_max)
            {
                ContentManager.data.energy = ContentManager.data.energy_max;
            }
            else
            {
                ContentManager.data.energy += n;
            }
        }
        else if (slt.Contains("keys"))
        {
            int n = Int32.Parse(slt.Split('_')[1]);

            GameObject o = GameObject.Instantiate(key, go.transform);
            o.GetComponentInChildren <Text>().text = "+" + n;

            ContentManager.data.keys += n;
        }

        Saver.save(ContentManager.data);
        Bars.update();
    }
Пример #11
0
    /// <summary>
    /// 根据json生成场景
    /// </summary>
    public void WriteEnvObject()
    {
        // json --> string
        string fileStream = Saver.ReadJsonString(Saver.WritePath + "/Level" + Level + "/MapObjectData.json");
        // string --> SetData
        LevelData fileData = JsonMapper.ToObject <LevelData>(fileStream);

        //主角的数据
        Player.transform.position    = new Vector3((float)fileData.positionX, (float)fileData.positionY, (float)fileData.positionZ);
        Player.transform.eulerAngles = new Vector3((float)fileData.rotateX, (float)fileData.rotateY, (float)fileData.rotateZ);


        string path;

        if (IsEditMode)
        {
            path = "Prefabs/EditMode/";
        }
        else
        {
            path = "Prefabs/PlayMode/";
        }
        foreach (var data in fileData.ObjectData)
        {
            int        id  = int.Parse(data.prefabId.Substring(0, 2));
            GameObject pre = Resources.Load(path + data.prefabId.Substring(0, 2)) as GameObject;
            GameObject g   = Instantiate(pre);
            g.transform.position    = new Vector3((float)data.positionX, (float)data.positionY, (float)data.positionZ);
            g.transform.eulerAngles = new Vector3((float)data.rotateX, (float)data.rotateY, (float)data.rotateZ);
            g.transform.localScale  = new Vector3((float)data.scaleX, (float)data.scaleY, (float)data.scaleZ);
            g.transform.parent      = env.transform;
        }
        foreach (var data in fileData.monsterDatas)
        {
            GameObject pre = Resources.Load(path + data.prefabId.Substring(0, 2)) as GameObject;
            GameObject g   = Instantiate(pre);
            g.transform.position    = new Vector3((float)data.positionX, (float)data.positionY, (float)data.positionZ);
            g.transform.eulerAngles = new Vector3((float)data.rotateX, (float)data.rotateY, (float)data.rotateZ);
            g.transform.localScale  = new Vector3((float)data.scaleX, (float)data.scaleY, (float)data.scaleZ);
            g.transform.parent      = env.transform;
            if (IsEditMode)
            {
                g.GetComponent <EditMonster>().IsLighting = data.IsLighting;
            }
            else
            {
                g.GetComponent <AIController>().hasStar = data.IsLighting;
            }
        }
        foreach (var data in fileData.triggerDatas)
        {
            GameObject pre = Resources.Load(path + data.prefabId.Substring(0, 2)) as GameObject;
            GameObject g   = Instantiate(pre);
            g.transform.position   = new Vector3((float)data.positionX, (float)data.positionY, (float)data.positionZ);
            g.transform.localScale = new Vector3((float)data.scaleX, (float)data.scaleY, (float)data.scaleZ);
            g.transform.parent     = env.transform;
            g.GetComponent <EditTrigger>().TriggerID = data.triggerID;
        }
    }
Пример #12
0
    public void clearSaveFile()
    {
        Saver sv = new Saver();

        sv.save(new List <Match>());

        SceneManager.LoadScene("Records");
    }
Пример #13
0
        public override List <ISaveable> GetSaveableRefs(SaveType type)
        {
            List <ISaveable> parentRef = Saver.ConstructSaveableList(base.GetSaveableRefs(type));

            parentRef.Add(actor);
            parentRef.Add(Stage);
            return(parentRef);
        }
Пример #14
0
 public async Task UpdateLocked(ISettings settings, Guid accountId, bool locked)
 {
     Saver saver = new Saver();
     await saver.Save(
         new TransactionHandler(settings),
         async th => await _dataSaver.UpdateLocked(th, accountId, locked)
         );
 }
Пример #15
0
 public async Task RemoveUser(ISettings settings, Guid userId, Guid accountId)
 {
     Saver saver = new Saver();
     await saver.Save(
         new TransactionHandler(settings),
         async th => await _dataSaver.RemoveUser(th, userId, accountId)
         );
 }
 public override void Save(Saver saver)
 {
     saver.Header("StringVariableHolder");
     saver.Save(this.varLink, "");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.End();
 }
Пример #17
0
 public void Save(Saver saver)
 {
     saver.Header("Person");
     saver.Save(name, "Name");
     saver.Save(age, "Age");
     //saver.SaveArray<int>(nums, "Nums");
     saver.End();
 }
Пример #18
0
 void Awake()
 {
     _player       = new Player();
     _player._info = Saver.Read();
     _instance     = this;
     DontDestroyOnLoad(this.gameObject);
     _scene = GameObject.Find("SceneManager").GetComponent <SceneManager>();
 }
 private void Button_Refresh_Powerpoint(object sender, RoutedEventArgs e)
 {
     if (pptx_location != null)
     {
         FileContent = Saver.GetContentFromPPTX(pptx_location);
         sm.Speak("Apresentação actualizada");
     }
 }
Пример #20
0
        public virtual void Save(BinaryWriter writer, SaveType type, Dictionary <ISaveable, uint> objectTable)
        {
            Saver.SaveString(id, writer);
            Saver.SaveColor(textColor, writer);
            Saver.SaveColor(iconColor, writer);

            Saver.SaveString(iconName, writer);
        }
Пример #21
0
 public async Task RemoveReactionRole(IRole role)
 {
     if ((Context.User as IGuildUser).GuildPermissions.Has(GuildPermission.ManageGuild))
     {
         Saver.RemoveReactionRole(Context.Guild.Id, role.Id);
         respond(await Context.Channel.SendMessageAsync("Rele removed from list, please use +DisplayRoles to update message"));
     }
 }
Пример #22
0
        static ItemController CreateSeparateService()
        {
            var reader  = new Reader <Item>();
            var saver   = new Saver <Item>();
            var deleter = new Deleter <Item>();

            return(new ItemController(reader, saver, deleter));
        }
Пример #23
0
        public IPackageInfo Create(string packageName, string groupName)
        {
            var pkg = Creator.Create(packageName, groupName);

            Saver.Save(FullPackagesDirectory, pkg);

            return(pkg);
        }
Пример #24
0
 /// <summary>
 /// set the object to be inserted when <see cref="UnitOfWork.SaveChanges"/> is called
 /// </summary>
 /// <param name="obj"></param>
 public virtual void Add(T obj)
 {
     if (obj == null)
     {
         throw new ArgumentNullException("entity");
     }
     Saver.Add(obj);
 }
 public void Save(Saver saver)
 {
     saver.Header("LooseDragDropLink");
     saver.Save(element, "Element");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.End();
 }
Пример #26
0
    public void Save()
    {
        Debug.Log("SAVE DM");
        Saver s = new Saver();

        tree.Pack();
        s.SaveSingle <DialogueTree>(tree, Saver.saveType.dialogue, dialogueID);
    }
Пример #27
0
        public override void LoadSetting()
        {
            bool State_sender = State;

            Saver.GetRecordObject(ID, ref State_sender);
            State = State_sender;
            ApplySetting();
        }
Пример #28
0
        static OrderController CreateSeparateServices()
        {
            var reader  = new Reader <Order>();
            var saver   = new Saver <Order>();
            var deleter = new Deleter <Order>();

            return(new OrderController(reader, saver, deleter));
        }
 public override void Save(Saver saver)
 {
     saver.Header("ObjectVariableHolder");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.Save(varLink, "Link");
     saver.End();
 }
Пример #30
0
 private void Start()
 {
     Cursor.lockState = CursorLockMode.Confined;
     Cursor.visible   = true;
     Saver.LoadSettings();
     QualitySettings.SetQualityLevel(Settings.current.grafic);
     zMax = Settings.current.maxZombie;
 }
Пример #31
0
 public void Perform()
 {
     OnPeforming();
     Saver.Populate();
     Assert.IsTrue(Saver.Files.Count == 3);
     Saver.Save();
     OnPerformed();
 }
Пример #32
0
 /// <summary>
 /// 清空进度存档
 /// </summary>
 public void ClearProgress()
 {
     m_IsPlaying       = false;
     m_MaxPassProgress = -1;
     m_PlayProgress    = -1;
     //设置存档
     Saver.SetGameProgress(m_MaxPassProgress);
 }
Пример #33
0
 /// <summary>
 /// 初始化
 /// </summary>
 public bool InitGame()
 {
     //读取游戏通关进度存档
     m_MaxPassProgress = Saver.GetGameProgress();
     //设置初始金币数
     Gold = 400;
     return(true);
 }
Пример #34
0
    /// <summary>
    /// 清档
    /// </summary>
    public void ClearProgress()
    {
        m_IsPlaying   = false;
        m_PlayLevelId = -1;

        m_GameProgress = -1;
        Saver.SetProgress(-1);
    }
 public override void Save(Saver saver)
 {
     saver.Header("NumberVariableHolder");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.Save(varLink, "Element");
     saver.End();
 }
Пример #36
0
 public virtual RegisterResult AddUser(IRegisterModel model)
 {
     model.Password = model.Password.ToMD5();
     Saver.Add((User)model);
     return(new RegisterResult {
         Success = true
     });
 }
Пример #37
0
 public GameControl(NewGame form, MainForm mform)
 {
     ngform = form;
     render = new Render(this, mform);
     loader = new Loader(mform, this);
     gamesaver = new Saver(mform, this);
     form.NewGameInit += new EventHandler(form_NewGameInit);
     render.mainform.lbGameLog.Items.Add("Добро пожаловать в Техасский холдем!");
 }
Пример #38
0
        private void RegisterEvent()
        {
            //List event
            _list.ItemClick += (arg1, arg2) => ShowSaveIndex(arg2.ItemIndex + 1);

            //Button event
            _saveButton.Click += (arg1, arg2) =>
            {
                if (_list.SelectionIndex != -1 &&
                    SaveLoadIndexInRange(_list.SelectionIndex + 1))
                {
                    if (Globals.IsSaveDisabled)
                    {
                        _message.Text = "此处无法存档";
                        return;
                    }

                    if (!Globals.TheGame.IsSafe())
                    {
                        _message.Text = "战斗中不能存档,找个安全的地方存档吧。";
                        return;
                    }

                    var index = _list.SelectionIndex + 1;

                    var show = GuiManager.IsShow;
                    //Hide GUI when take snapshot
                    GuiManager.IsShow = false;
                    var snapshot = Globals.TheGame.TakeSnapShot();
                    //Restore
                    GuiManager.IsShow = show;

                    Saver.SaveGame(index, snapshot);

                    IsShow = false;
                    GuiManager.ShowSystem(false);
                }
            };
            _loadButton.Click += (arg1, arg2) =>
            {
                if (_list.SelectionIndex != -1 &&
                    SaveLoadIndexInRange(_list.SelectionIndex + 1))
                {
                    var index = _list.SelectionIndex + 1;
                    if (StorageBase.CanLoad(index))
                    {
                        IsShow = false;
                        Loader.LoadGame(index);
                    }
                }
            };
            _exitButton.Click += (arg1, arg2) =>
            {
                IsShow = false;
                GuiManager.ShowSaveLoad(false);
            };
        }
Пример #39
0
 /// <summary>
 /// 结束关卡
 /// </summary>
 public void StopLevel(bool isWin)
 {
     if (isWin && PlayLevelIndex > GameProgress)
     {
         _gameProgress = PlayLevelIndex;
         Saver.SetProgress(PlayLevelIndex);
     }
     _isPlaying = false;
 }
 public override void Save(Saver saver)
 {
     saver.Header("LightLevelCircle");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.Save(width, "Radius");
     saver.Save(culled, "Culled");
     ((GameSaver)saver).Save(color, "Color");
     saver.End();
 }
        public override void Save(Saver saver)
        {
            saver.Header("BooleanHolder");

            saver.Save(varLink, "Link");
            saver.Save(x, "X");
            saver.Save(y, "Y");

            saver.End();
        }
Пример #42
0
 public override void Save(Saver saver)
 {
     saver.Header("LCircle");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.Save(width, "Radius");
     ((GameSaver)saver).Save(color, "Color");
     ((GameSaver)saver).Save(border, "Border");
     saver.Save(borderMode, "BorderMode");
     saver.End();
 }
        public static void Main()
        {
            var memento = new Saver<StormTrooper>();

            var originalGosho = new StormTrooper("gosho");

            originalGosho.AddEquipment("gun");

            memento.SaveState(originalGosho);

            originalGosho.AddEquipment("rubber duck");
            originalGosho.AddEquipment("stormtrooper helmet");

            Console.WriteLine("The saved gosho has {0} in his equipment list", string.Join(", ", memento.GetState().Equipment));
            Console.WriteLine("The original gosho has {0} in his equipment list", string.Join(", ", originalGosho.Equipment));

            Console.WriteLine("\n\n");

            var arr = new int[] { 1, 2, 3, 4, 5, 6, -423234324 };

            var intArrMemento = new Saver<int[]>();
            intArrMemento.SaveState(arr);

            arr[0] = 149234;

            Console.WriteLine("Saved state of the array: {0}", string.Join(", ", intArrMemento.GetState()));
            Console.WriteLine("Current state of the array: {0}", string.Join(", ", arr));

            Console.WriteLine("\n\n");

            var gotShip = new SpaceShip("tarataika", "jeko snejev");

            var shipMemento = new Saver<SpaceShip>();

            shipMemento.SaveState(gotShip);

            gotShip.PilotName = "paolo koelio";
            shipMemento.SaveState(gotShip);

            gotShip.PilotName = "djordjano";
            shipMemento.SaveState(gotShip);

            gotShip.PilotName = "pesho";

            var pilots = new List<string>();

            while (shipMemento.HasStates)
            {
                pilots.Add(shipMemento.GetState().PilotName);
            }

            Console.WriteLine("The ship has been piloted by: {0}", string.Join(", ", pilots));
            Console.WriteLine("The current ship's pilot is: {0}", gotShip.PilotName);
        }
Пример #44
0
        public void TestIfConstructorWithParametersHasTheSameBehaviorAsTheSetter()
        {
            var game = new GameModel();
            this.logic.RandomizeBalloonField(game.Field);
            this.memento.SaveState(game);
            var memento2 = new Saver<IGameModel>();
            memento2.SaveState(game);

            var stateFromMemento = this.memento.GetState();

            var areEqual = new QueryableMatrix<IBalloon>(memento2.GetState().Field)
                                .Join(new QueryableMatrix<IBalloon>(stateFromMemento.Field), x => x, y => y, (x, y) => (x.IsPopped == y.IsPopped) && (x.Number == y.Number))
                                .All(x => x);

            Assert.IsTrue(areEqual);
        }
Пример #45
0
        public Editor(ZoombaSmasher zoomba)
            : base(zoomba)
        {
            this.zoomba = zoomba;
            mapDir = Path.Combine(zoomba.Content.RootDirectory, basePath);
            rows = 30;
            columns = 40;
            squares = new MapSquare[rows,columns];
            windowWidth = zoomba.graphics.PreferredBackBufferWidth;
            windowHeight = zoomba.graphics.PreferredBackBufferHeight;
            squareWidth = windowWidth / columns;
            squareHeight = windowHeight / rows;
            saver = new Saver(this);
            saver.Bounds = new Rectangle(windowWidth / 4, windowHeight / 4,
                windowWidth / 2, windowHeight / 2);
            saver.Text = "";
            cursor = new Cursor(zoomba, windowWidth / 2, windowHeight / 2);
            actions = new Actions();
            loader = new Loader(this);

            SetValidNameCharacters();
        }
Пример #46
0
        public void Save(Saver saver)
        {
            throw new NotImplementedException("Saving is disabled until layer grouping is finished.");

            #if SAVE_ENABLED

            //Global.xml
            PropertyWriter pGlobal = saver.CreatePropertyFile("global.xml");

            pGlobal.Set("scriptvm", scriptvm);
            pGlobal.Set("startscript", startupScriptName);
            pGlobal.Set("quitscript", quitScriptName);
            pGlobal.Set("defaultmap", startupMapName);
            pGlobal.Set("tilesize", tileSize);
            pGlobal.Set("startx", startX);
            pGlobal.Set("starty", startY);
            pGlobal.Set("startl", startLayer);
            pGlobal.Set("screenwidth", screenWidth);
            pGlobal.Set("screenheight", screenHeight);

            PropertyWriter pParty = pGlobal.Create("party");
            foreach (Sprite sp in party) {
                pParty.Set("character", sp.Name);
            }

            //Needed later
            PropertyWriter pLocations = pGlobal.Create("locations");

            //Images
            List<string> imageList = new List<string>();
            foreach (KeyValuePair<string, SpriteSheet> sheet in this.sheets) {
                imageList.Add(sheet.Key);
                saver.Save("img/" + sheet.Key + ".png", sheet.Value.sheet);
                PropertyWriter pImg = saver.CreatePropertyFile("img/" + sheet.Key + ".xml");

                pImg.Set("width", sheet.Value.spriteWidth);
                pImg.Set("height", sheet.Value.spriteHeight);
                pImg.Set("x", sheet.Value.x);
                pImg.Set("y", sheet.Value.y);
            }
            saver.Save("img.list", string.Join("\n", imageList.ToArray()));

            //Sprites
            List<string> spriteList = new List<string>();
            foreach (KeyValuePair<string, Sprite> sprite in this.sprites) {
                spriteList.Add(sprite.Key);
                PropertyWriter pSprite = saver.CreatePropertyFile("sprites/" + sprite.Value.Name + ".xml");
                pSprite.Set("animation", sprite.Value.animation.Name);
                pSprite.Set("speed", sprite.Value.speed);
                pSprite.Set("noclip", sprite.Value.noclip);
                PropertyWriter exts = pSprite.Create("exts");
                foreach (KeyValuePair<string, string> kvp in sprite.Value.ext) {
                    PropertyWriter ext = exts.Create("ext");
                    ext.Set("key", kvp.Key);
                    ext.Set("value", kvp.Value);
                }
            }
            saver.Save("sprites.list", string.Join("\n", spriteList.ToArray()));

            //Maps
            List<string> mapList = new List<string>();
            foreach (KeyValuePair<string, Map> map in this.maps) {
                mapList.Add(map.Key);
                PropertyWriter pInfo = saver.CreatePropertyFile("maps/" + map.Key + "/info.xml");
                pInfo.Set("layers", map.Value.layerGroups.Count);
                pInfo.Set("width", map.Value.width);
                pInfo.Set("height", map.Value.height);

                PropertyWriter pObjects = saver.CreatePropertyFile("maps/" + map.Key + "/objects.xml");
                PropertyWriter pOnStep = saver.CreatePropertyFile("maps/" + map.Key + "/onstep.xml");

                for (int l = 0; l < map.Value.layers.Count; ++l) {
                    LayerGroup layer = map.Value.layers[l];
                    List<string> tileList = new List<string>();
                    List<string> passList = new List<string>();
                    for (int j = 0; j < map.Value.height; ++j) {
                        string[] tileLine = new string[map.Value.width];
                        string[] passLine = new string[map.Value.width];
                        for (int i = 0; i < map.Value.width; ++i) {
                            tileLine[i] = layer.tiles[i, j].gfx.Id.ToString();
                            passLine[i] = layer.tiles[i, j].passable ? "1" : "0";
                            if (!string.IsNullOrEmpty(layer.tiles[i, j].onStep)) {
                                PropertyWriter pEvent = pOnStep.Create("event");
                                pEvent.Set("x", i);
                                pEvent.Set("y", j);
                                pEvent.Set("layer", l);
                                pEvent.Set("script", layer.tiles[i, j].onStep);
                            }
                            if (!string.IsNullOrEmpty(layer.tiles[i, j].locationName)) {
                                string locName = layer.tiles[i, j].locationName;
                                PropertyWriter location = pLocations.Create("location");
                                location.Set("name", locName);
                                location.Set("x", i);
                                location.Set("y", j);
                                location.Set("layer", l);
                                location.Set("map", map.Key);
                            }
                            if (layer.objects[i, j] != null) {
                                Map.Obj obj = layer.objects[i, j];
                                PropertyWriter pObject = pObjects.Create("object");
                                pObject.Set("x", i);
                                pObject.Set("y", j);
                                pObject.Set("layer", l);
                                pObject.Set("sprite", obj.Sprite.Name);
                                pObject.Set("action", obj.actionScript);
                                pObject.Set("movement", obj.movementAIScript);
                                pObject.Set("collide", obj.collideScript);
                            }
                        }
                        tileList.Add(string.Join(" ", tileLine));
                        passList.Add(string.Join(" ", passLine));
                    }
                    saver.Save(string.Format("maps/{0}/layers/tiles.{1}", map.Key, l), string.Join("\n", tileList.ToArray()));
                    saver.Save(string.Format("maps/{0}/layers/passability.{1}", map.Key, l), string.Join("\n", passList.ToArray()));
                    saver.Save(string.Format("maps/{0}/layers/name.{1}", map.Key, l), layer.name);
                }

                PropertyWriter pLadders = saver.CreatePropertyFile("maps/" + map.Key + "/ladders.xml");
                for (int i = 0; i < map.Value.width; ++i) {
                    for (int j = 0; j < map.Value.height; ++j) {
                        Map.Ladder ladder = map.Value.ladders[i, j];
                        if (ladder != null) {
                            PropertyWriter pLadder = pLadders.Create("ladder");
                            pLadder.Set("x", i);
                            pLadder.Set("y", j);
                            pLadder.Set("base", map.Value.layers.IndexOf(ladder.baseLayer));
                            pLadder.Set("top", map.Value.layers.IndexOf(ladder.topLayer));
                        }
                    }
                }
            }
            saver.Save("maps.list", string.Join("\n", mapList.ToArray()));

            //Scripts
            List<string> scriptList = new List<string>();
            foreach (Script script in scripts) {
                if (script.IsFolder) {
                    scriptList.Add(script.Name + "/");
                }
                else {
                    scriptList.Add(script.Name);
                    saver.Save("scripts/" + script.Name, script.Text);
                }
            }
            saver.Save("scripts.list", string.Join("\n", scriptList.ToArray()));

            //Animations
            List<string> animationList = new List<string>();
            foreach (KeyValuePair<string, Animation> animKvp in animations) {
                animationList.Add(animKvp.Key);
                Animation anim = animKvp.Value;
                PropertyWriter pAnim = saver.CreatePropertyFile("animations/" + animKvp.Key + ".xml");
                pAnim.Set("sheet", anim.sheet.Name);
                foreach (KeyValuePair<string, Animation.Group> groupKvp in anim.groups) {
                    PropertyWriter pGroup = pAnim.Create("group");
                    pGroup.Set("name", groupKvp.Key);
                    foreach (Animation.Frame frame in groupKvp.Value.frames) {
                        PropertyWriter pFrame = pGroup.Create("frame");
                        pFrame.Set("sheetid", frame.sheetId);
                        pFrame.Set("time", frame.time);
                    }
                }
            }
            saver.Save("animations.list", string.Join("\n", animationList.ToArray()));

            //Musics
            List<string> musicList = new List<string>();
            foreach (var musicKvp in musics) {
                musicList.Add(musicKvp.Key);
                if (musicKvp.Value.NeedsSaving || !saver.Exists("music/" + musicKvp.Key)) {
                    saver.Save("music/" + musicKvp.Key, musicKvp.Value.Content);
                }
            }
            saver.Save("music.list", string.Join("\n", musicList.ToArray()));

            //All the stuff we don't deal with yet
            saver.Save("dialog/windowborder.png", windowBorderFile);
            saver.Save("dialog/dialog.xml", dialogFile);
            saver.Save("dialog/" + fontFileName, fontFile);
            #endif
        }
 public void Save(Saver saver)
 {
     saver.Header("StackNumber");
     saver.Save(value, "Value");
     saver.End();
 }
 public override void Save(Saver saver)
 {
     saver.Header("NumberMethodDragDrop");
     saver.Save(holderA, "HolderA");
     saver.Save(holderB, "HolderB");
     saver.Save(mode, "Mode");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.End();
 }
        public void Save(Saver saver)
        {
            if(!fullSave)
            saver.Header("TajLevelLinker");
            if (fullSave) saver.Header("TajLevelSave");
            saver.Save(rowCleared, "RowCleared");
            saver.Save(redCleared, "RedCleared");
            saver.Save(blueCleared, "BlueCleared");
            saver.Save(greenCleared, "GreenCleared");
            saver.Save(tealCleared, "TealCleared");
            saver.Save(orangeCleared, "OrangeCleared");
            saver.Save(yellowCleared, "YellowCleared");
            saver.Save(anyCleared, "AnyCleared");
            saver.Save(purpleCleared, "PurpleCleared");
            saver.Save(Start, "Start");
            if(!fullSave)
            saver.Save(fileName, "FileName");
            if (fullSave)
            {
                saver.Save(parser, "Parser");
                saver.Save(text, "Text");

                saver.Save(flashLight, "Flashlight");
                saver.Save(game, "Game");
                saver.Save(new World(world.GetObjects()), "World");
            }

            saver.End();
        }
Пример #50
0
 public override void Save(Saver saver)
 {
     saver.Header("BooleanMethod");
     saver.Save(holderA, "HolderA");
     saver.Save(holderB, "HolderB");
     saver.Save(mode, "Mode");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.End();
 }
Пример #51
0
 public void Save(Saver saver)
 {
     saver.Header("TajParser");
     saver.Save(stack, "Stack");
     saver.SaveArray<String>(variables.Keys.ToArray(), "Keys");
     saver.SaveArray<StackObject>(variables.Values.ToArray(), "Values");
     saver.End();
 }
 public abstract void Save(Saver saver);
 public override void Save(Saver saver)
 {
     saver.Header("EventChooser");
     saver.Save(x, "X");
     saver.Save(y, "Y");
     saver.Save(eventName, "Event");
     saver.End();
 }
Пример #54
0
        public override void Save(Saver saver)
        {
            saver.Header("NumberTextbox");
            saver.Save(x, "X");
            saver.Save(y, "Y");
            saver.Save(text, "Text");

            saver.End();
        }
 public override void Save(Saver saver)
 {
     throw new NotImplementedException();
 }
Пример #56
0
    // Use this for initialization
    void Start()
    {
        saver = GameObject.FindObjectOfType<Saver>();

           saver.Save();
    }
 public void Save(Saver saver)
 {
     saver.Header("StackString");
     saver.Save(value, "Value");
     saver.End();
 }
 public void Save(Saver saver)
 {
     saver.Header("StackBoolean");
     saver.Save(value, "Value");
     saver.End();
 }
			Saver GetAvailableSaver()
			{
				foreach (var saver in FSavers)
				{
					if (saver.Available)
					{
						return saver;
					}
				}

				var newSaver = new Saver();
				FSavers.Add(newSaver);
				return newSaver;
			}
Пример #60
0
 public override void Save(Saver saver)
 {
     saver.Header("LevelPerson");
     saver.Save(x, "X");
     ((GameSaver)saver).Save(color, "Color");
     ((GameSaver)saver).Save(colorB, "Border");
     saver.Save(y, "Y");
     saver.Save(width, "Width");
     saver.Save(height, "Height");
     saver.Save(blink, "Blink");
     saver.Save(animation, "BodyAnimation");
     saver.Save(frame, "Frame");
     saver.Save(playing, "Playing");
     saver.Save(loop, "Loop");
     if(name != "")
     {
         saver.Save(name, "Name");
     }
     saver.End();
 }