コード例 #1
0
    public void doSth()
    {
        string fileName = "file" + (optionNum * nowPage + cursorPos + 1);
        string filePath = Application.dataPath + @"/Save/" + fileName + ".json";

        // 读取
        if (tabPos == 0)
        {
            saveData data = dataManager.instance.loadData("file" + (optionNum * nowPage + cursorPos + 1));
            if (gameManager.instance.player != null)
            {
                Destroy(menuPanel);
            }
            gameManager.instance.LoadLevel(data.mapName, data.team[0], data.position.toVec3(), data.turn.toVec3());
            exit();
        }
        else if (tabPos == 1)// 保存
        {
            dataManager.instance.saveData("file" + (optionNum * nowPage + cursorPos + 1));
            exit();
        }
        else// 删除
        {
            dataManager.instance.deleteFile(filePath);
            drawPanel();
        }
    }
コード例 #2
0
        public void Post([FromBody] cart value)
        {
            Console.WriteLine(value);
            iPostCart insertObject = new saveData();

            insertObject.UpdateCart(value.itemName, value.price);
        }
コード例 #3
0
ファイル: gameManager.cs プロジェクト: solidcellaMoon/GodBird
    //세이브 함수
    public static void Save()
    {
        saveData data = new saveData();

        //각 스크립트에서 값을 data의 변수들에 넣고 파일에 쓴다.
        data.beanNum = itemManager.beanNum;
        data.diceNum = itemManager.diceNum;
        data.birdNum = itemManager.birdNum;
        data.dateNum = dateManager.dateNum;
        data.debtNum = itemManager.debtNum;
        data.chLevel = churchManager.chLevel;
        for (int i = 0; i < 6; i++)
        {
            data.npcGage[i] = npcManager.npcGage[i];
            data.npcEnc[i]  = npcManager.npcEnc[i];
            data.npcList[i] = npcManager.npcList[i];
        }
        data.tutorial      = tutorialManager.tutorial; // 지현
        data.gameClear     = gameManager.gameClear;    // 지현
        data.ClearNum      = successEvent.ClearNum;    // 지현
        data.startpanelSee = data.startpanelSee;

        data.weekNum    = dateManager.weekNum;
        data.gameRetry  = dateManager.gameRetry;
        data.decideDebt = dateManager.decideDebt;
        File.WriteAllText(Application.persistentDataPath + "/clearInfo.json", JsonUtility.ToJson(data));
        Debug.Log("세이브!");
    }
コード例 #4
0
ファイル: gameManager.cs プロジェクト: solidcellaMoon/GodBird
    //**  세이브 함수들   **//

    //저장 파일 만드는 함수
    public static void makeD()
    {
        saveData data = new saveData();

        //저장값들을 전부 초기값으로 설정
        data.beanNum = 25000000; // 보유 콩 개수
        data.diceNum = 10;       // 보유 주사위 개수
        data.birdNum = 1;        // 보유 신도 수
        data.dateNum = -1;       // 게임상의 날짜
        data.debtNum = 150;      // 현재 갚아야 할 빚 액수
        data.chLevel = 0;        // 현재 교회 레벨
        for (int i = 0; i < 6; i++)
        {
            data.npcGage[i] = 0;  // npc별 현재 호감도 수치
            data.npcEnc[i]  = 0;  // npc별 현재 만남 횟수
            data.npcList[i] = false;
        }
        data.tutorial      = true;
        data.mgTutorial    = true; // 추가(지현)
        data.startpanelSee = true;

        data.weekNum    = 0;     // week: n주차
        data.gameRetry  = 3;     //미니게임 가능 횟수
        data.decideDebt = false;
        data.gameClear  = false; // 게임 클리어 여부(지현)
        data.ClearNum   = 0;     // 증축 성공 횟수(지현)

        File.WriteAllText(Application.persistentDataPath + "/clearInfo.json", JsonUtility.ToJson(data));
        //Debug.Log("저장 파일 생성!");
    }
コード例 #5
0
    public int getLevelIndex(saveData data)     // Use a try catch block to check if the level exists in the list, if not, add it to the list and increase the initialized level count
    {
        currentLevelIndex = data.level.FindIndex(x => x.levelName == currentScene.name);
        if (currentLevelIndex < 0)
        {
            print("Adding " + currentScene.name + " to the save data Level list.");
            data.level [data.initializedLevelCount].levelName = currentScene.name;
            currentLevelIndex = data.initializedLevelCount;
            data.initializedLevelCount++;
        }
        return(currentLevelIndex);

        /* try
         * {
         *
         *      currentLevelIndex	= data.level.FindIndex (x => x.levelName == currentScene.name);
         *      print("Try code suceeded");
         * }
         * catch
         * {
         *      print ("Adding " + currentScene.name + " to the save data Level list.");
         *      data.level [data.initializedLevelCount].levelName = currentScene.name;
         *      currentLevelIndex = data.initializedLevelCount;
         *      data.initializedLevelCount++;
         * }
         * return currentLevelIndex;*/
    }
コード例 #6
0
    public void saveData(string fileName)
    {
        saveData data = new saveData();

        data.version  = Application.version;
        data.playTime = gameManager.instance.playTime;

        data.switchD = switchD;
        data.intD    = intD;
        data.floatD  = floatD;

        data.independentSwitches = independentSwitches;

        data.items  = items;
        data.quests = quests;

        data.mapName  = gameManager.instance.nowScene;
        data.position = new vector3d(gameManager.instance.player.transform.position);
        data.team     = team;
        data.turn     = new vector3d(gameManager.instance.player.turn);

        string filePath = Application.dataPath + @"/Save/" + fileName + ".json";
        //找到当前路径
        FileInfo file = new FileInfo(filePath);
        //判断有没有文件,有则打开文件,,没有创建后打开文件
        StreamWriter sw = file.CreateText();
        //ToJson接口将你的列表类传进去,,并自动转换为string类型
        string json = JsonMapper.ToJson(data);

        //将转换好的字符串存进文件,
        sw.WriteLine(json);
        //注意释放资源
        sw.Close();
        sw.Dispose();
    }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        //load savefile on startup
        overallData = new saveData();
        Debug.Log("init");
        if (!overallData.loadfile())
        {
            overallData.set(gameData.init);
            overallData.saveFile();
        }
        //init events
        if (EventNotifier == null)
        {
            EventNotifier = new EventWithMessage();
        }
        if (OnMoneyChanged == null)
        {
            OnMoneyChanged = new UnityEvent();
        }
        if (OnGameInitialize == null)
        {
            OnGameInitialize = new UnityEvent();
        }
        if (OnCatDataChaged == null)
        {
            OnCatDataChaged = new UnityEvent();
        }
        if (OnItemDataChanged == null)
        {
            OnItemDataChanged = new UnityEvent();
        }
        if (OnCraftingStarted == null)
        {
            OnCraftingStarted = new UnityEvent();
        }
        if (OnCraftingEnded == null)
        {
            OnCraftingEnded = new UnityEvent();
        }
        if (OnGroupDataChanged == null)
        {
            OnGroupDataChanged = new UnityEvent();
        }
        if (OnExploreEnded == null)
        {
            OnExploreEnded = new UnityEvent();
        }
        if (OnExploreStarted == null)
        {
            OnExploreStarted = new UnityEvent();
        }
        if (OnLevelDataChanged == null)
        {
            OnLevelDataChanged = new UnityEvent();
        }
        OnGameInitialize.AddListener(OnGameInitializehandler);

        OnGameInitialize.Invoke();
    }
コード例 #8
0
    public void Load()
    {
        Debug.Log("loading");
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(Application.persistentDataPath + "/saveinfo.dat", FileMode.Open);
        saveData        data = (saveData)bf.Deserialize(file);

        file.Close();
        topGameName       = data.topGameName;
        topGameIdentifier = data.topGameIdentifier;
        allGames          = data.allGames;
        upperarm          = data.upperarm;
        lowerarm          = data.lowerarm;
        lowerleg          = data.lowerleg;
        upperleg          = data.upperleg;
        body      = data.body;
        skintone  = new Color(data.skintoneR, data.skintoneG, data.skintoneB, 1f);
        shoes     = data.shoes;
        hair      = data.hair;
        hairColor = new Color(data.hairR, data.hairG, data.hairB, 1f);

        selectedBody         = data.selectedBody;
        selectedFace         = data.selectedFace;
        selectedHair         = data.selectedHair;
        unlockedWordList     = data.unlockedWordList;
        allGamesNames        = data.allGamesNames;
        rating               = data.rating;
        competeingRatings    = data.competeingRatings;
        competeAgainDate     = data.competeAgainDate;
        isCompeting          = data.isCompeting;
        canCompete           = data.canCompete;
        totalMoney           = data.totalMoney;
        moneyClickMultiplier = data.moneyClickMultiplier;
        gameShopItems        = data.gameShopItems;
        shopItemsCosts       = data.shopItemsCosts;
        shopCounts           = data.shopCounts;
        shopItemValue        = data.shopItemValue;
        shopPrices           = data.shopPrices;
        donutsPerSecond      = data.donutsPerSecond;
        latestTime           = data.latestTime;



        awardPointCount = data.awardPointCount;
        //Tier1
        buyWord             = data.buyWord;
        placingMedal        = data.placingMedal;
        raising10k          = data.raising10k;
        submitToLeaderboard = data.submitToLeaderboard;
        //Tier2
        placeFirst  = data.placeFirst;
        buyAllWords = data.buyAllWords;
        raise500k   = data.raise500k;
        //FBLA ULTIMATE MEDAL
        FblaExcellenceAward = data.FblaExcellenceAward;
    }
コード例 #9
0
    public void saveFile(saveData data)
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + data.ToString() + ".dat");

        print("This was saved to " + Application.persistentDataPath + data.ToString() + ".dat");

        /*
         * This area was to test the save data, what now should happen is the data is already in existance, and this just saves it.
         *
         */
        //data.scores[0] = 1.1111f;

        /*data.level.Add( new Level());
         * //data.level [0].scene = currentScene;
         * data.level [0].worldNumber = 420000;
         * data.number = 25.35f;
         * data.scores = new float[numberofLevels];
         * data.scores [currentScene.buildIndex] = score;
         */
        int index;

        if (currentScene.name == "puffinNestattempt")
        {
            index = previousLevelIndex;
        }
        else
        {
            index = currentLevelIndex;
        }
        if (score > data.level [index].levelHighScore)
        {
            data.level [index].levelHighScore = score;
        }
        if (currentPuffletsHatched > data.level [index].puffletsHatched)
        {
            data.level [index].puffletsHatched = currentPuffletsHatched;
        }

        /*
         * here I create an instance of class and give it the data to store
         * saveData data = new saveData();
         *      data.health = health;
         *      data.experience = experience;
         *
         *
         */
        /*	if (data.level [currentLevelIndex].levelHighScore < score)
         *      {
         *              data.level [currentLevelIndex].levelHighScore = score;
         *      }*/
        bf.Serialize(file, data);
        file.Close();
    }
コード例 #10
0
ファイル: GameManager.cs プロジェクト: Edacth/Flying-Game
    public void Save()
    {
        saveData data       = new saveData(sensitivity, yAxisFlipped, firstPlay, highScore);
        string   path       = Path.Combine(Application.persistentDataPath, "save.txt");
        string   jsonString = JsonUtility.ToJson(data);

        using (StreamWriter streamWriter = File.CreateText(path))
        {
            streamWriter.Write(jsonString);
        }
    }
コード例 #11
0
    // Use this for initialization
    void Start()
    {
        //print ("Start Called");
        airMeter = slider.GetComponent <Slider> ();



        if (data1 != null)
        {
            //loadFile (data1);
        }
        else
        {
            /*
             * //data1.level.Add( new Level());
             * //data.level [0].scene = currentScene;
             * data1.level [0].worldNumber = 420000;
             * data1.number = 25.35f;
             * data1.scores = new float[numberofLevels];
             * data1.level [currentScene.buildIndex].levelHighScore = 0 ;*/
        }


        //this loads the save data and populates the list of levels.
        data1 = loadFile(data1);          //this is already checking if the file exists.
        print(data1.level.Count);

        /* if (data1.level.Count == LevelManager.instance.Levels.Count ) //this is for when Levels was an array if (data1.level.Count == LevelManager.instance.Levels.Length )
         * {
         *      print ("There are no new levels");
         *
         * }
         * else if (data1.level.Count < LevelManager.instance.Levels.Count)//this is for when Levels was an array if (data1.level.Count < LevelManager.instance.Levels.Length )
         * {
         *      print ("Initializing LeveLs");
         *      //this should be polished, so only levels that aren't already in the list are added
         *
         *      foreach (string scene in LevelManager.instance.Levels)//UnityEngine.Object
         *      {
         *              data1.level.Add( new Level(scene));
         *
         *      }
         *
         *
         * } */

        gameInitialized = true;
        print("First attempt to get level index");
        currentLevelIndex = getLevelIndex(data1);
        print("Level index is " + currentLevelIndex);
        //currentLevelIndex	= data1.level.FindIndex (x => x.levelName == currentScene.name); //duplicate to on LevelFinished Loading
    }
コード例 #12
0
ファイル: saveLoad.cs プロジェクト: TomyJPN/KanmonGG
    /// <summary>
    /// データのロードを行う
    /// </summary>
    public static void Load()
    {
        string loadJsonStr = PlayerPrefs.GetString("playerData", ""); //データのロード 第2引数は設定されていなかった場合の空データ設定

        Debug.Log("古いLoad:" + loadJsonStr);
        if (string.IsNullOrEmpty(loadJsonStr)) //セーブデータがない場合無駄な処理を行わないためのif文
        {
            Debug.Log("セーブデータはないよ!");
        }
        else
        {
            chara = JsonUtility.FromJson <saveData>(loadJsonStr);
        }
    }
コード例 #13
0
        static void Main(string[] args)
        {
            saveData obj = new saveData();

            FileStream    fopen         = new FileStream("abc.xml", FileMode.Open);
            XmlSerializer x             = new XmlSerializer(obj.GetType());
            StreamReader  read_from_xml = new StreamReader(fopen);

            obj = (saveData)x.Deserialize(read_from_xml);

            Console.WriteLine(obj.strFolder1 + "=>" + obj.strFolder2 + "=>" + obj.strTabName + "=>" + obj.strTabText);
            Console.ReadKey();
            fopen.Close();
        }
コード例 #14
0
    //Save current state of progress via JSON
    private void SaveProgress()
    {
        //Create a new Save data
        saveData sD = new saveData();

        //Assign current status to that saved data
        sD.gold = player.gold;
        sD.Attack = Upgrade.mAT;
        sD.Shield = Upgrade.mSH;
        sD.LevelOneHS = Level1.HighScore;

        //Parse it to JSON
        string dataJson = JsonUtility.ToJson(sD);
        string saveState = Path.Combine(Application.persistentDataPath, saveName);

        //Write file
        File.WriteAllText(saveState, dataJson);
    }
コード例 #15
0
ファイル: GameManager.cs プロジェクト: Edacth/Flying-Game
    public void Load()
    {
        string path = Path.Combine(Application.persistentDataPath, "save.txt");

        if (!File.Exists(path))
        {
            return;
        }

        using (StreamReader streamReader = File.OpenText(path))
        {
            string   jsonString = streamReader.ReadToEnd();
            saveData data       = JsonUtility.FromJson <saveData>(jsonString);
            sensitivity  = data.sensitivity;
            yAxisFlipped = data.yAxisFlipped;
            firstPlay    = data.firstPlay;
            highScore    = data.highScore;
        }
    }
コード例 #16
0
    public saveData loadFile(saveData data)
    {
        if (File.Exists(Application.persistentDataPath + data.ToString() + ".dat"))
        {
            //try{
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + data.ToString() + ".dat", FileMode.Open); //persistant data path that Unity makes// playerInfo is specific file //filemode
            data = (saveData)bf.Deserialize(file);                                                                      //cast this to the object we need. It is stored as a generic object
            file.Close();

            print(data.name + "'s file was loaded");
            print("Save file located at" + Application.persistentDataPath + data.ToString() + ".dat");


            return(data);


            /*print(data.number);
             * print (data.scores [currentScene.buildIndex]);
             * scoreText.text = data.scores[currentScene.buildIndex] + " Eels collected!";
             * print(data.level[0].worldNumber);
             * //print(data.level [0].scene.name);*/

            /*
             * this is where you give your script the data that was just loaded
             * health = data.health;
             * experience = data.experience;
             */
            //}

            /*catch(ArgumentOutOfRangeException r)
             * {
             *
             *
             * }*/
        }
        else
        {
            print("File Doesn't exist, so it can't be loaded");
            return(data);
        }
    }
コード例 #17
0
    public saveData loadData(string fileName)
    {
        string   txt  = File.ReadAllText(Application.dataPath + @"/Save/" + fileName + ".json");
        saveData data = JsonMapper.ToObject <saveData>(txt);

        gameManager.instance.playTime += data.playTime;

        switchD = data.switchD;
        intD    = data.intD;
        floatD  = data.floatD;

        independentSwitches = data.independentSwitches;

        items  = data.items;
        quests = data.quests;

        team = data.team;

        return(data);
    }
コード例 #18
0
 public void StartButton()
 {
     if (File.Exists(Application.persistentDataPath + "/saveinfo.dat"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.persistentDataPath + "/saveinfo.dat", FileMode.Open);
         saveData        data = (saveData)bf.Deserialize(file);
         file.Close();
         allGames = data.allGames;
         upperarm = data.upperarm;
         lowerarm = data.lowerarm;
         lowerleg = data.lowerleg;
         upperleg = data.upperleg;
         body     = data.body;
         skintone = new Color(data.skintoneR, data.skintoneB, data.skintoneG);
         shoes    = data.shoes;
         hair     = data.hair;
     }
     SceneManager.LoadScene("customize", LoadSceneMode.Single);
 }
コード例 #19
0
        private List <saveData> changeToSaveData(List <data> dataList)
        {
            List <saveData> tempData = new List <saveData>();

            foreach (data i in dataList)
            {
                saveData temp = new saveData();

                temp.imageData = ImageToBuffer(i.imageData, ImageFormat.Jpeg);
                temp.oriImage  = ImageToBuffer(i.oriImage, ImageFormat.Jpeg);
                temp.title     = i.title;
                temp.des       = i.des;
                temp.filePath  = i.filePath;
                temp.date      = i.date;
                tempData.Add(temp);
            }


            return(tempData);
        }
コード例 #20
0
        public void LoadSave(string name)
        {
            XmlDocument xDoc = new XmlDocument();
            string      path = "Saves/" + name;

            string saveName;
            double saveTC;
            int    saveCredits;
            int    saveXpMaterials;
            int    saveXpPropulsion;
            int    saveXpLifeSupport;
            int    saveXpElectronics;
            int    saveXpAstronomy;

            if (Directory.Exists("Saves/" + name))
            {
                List <System.IO.FileInfo> sortedFiles = new DirectoryInfo(path).GetFiles().OrderByDescending(x => x.LastWriteTime).ToList();
                if (sortedFiles.Count > 0)
                {
                    xDoc.Load("Saves/" + name + "/" + sortedFiles[0].Name);

                    saveName          = xDoc.SelectSingleNode("Save/Name").InnerText;
                    saveTC            = Convert.ToDouble(xDoc.SelectSingleNode("Save/Timecode").InnerText);
                    saveCredits       = Convert.ToInt32(xDoc.SelectSingleNode("Save/Credits").InnerText);
                    saveXpMaterials   = Convert.ToInt32(xDoc.SelectSingleNode("Save/Experience/Materials").InnerText);
                    saveXpPropulsion  = Convert.ToInt32(xDoc.SelectSingleNode("Save/Experience/Propulsion").InnerText);
                    saveXpLifeSupport = Convert.ToInt32(xDoc.SelectSingleNode("Save/Experience/LifeSupport").InnerText);
                    saveXpElectronics = Convert.ToInt32(xDoc.SelectSingleNode("Save/Experience/Electronics").InnerText);
                    saveXpAstronomy   = Convert.ToInt32(xDoc.SelectSingleNode("Save/Experience/Astronomy").InnerText);

                    CurrentSaveData = new saveData(saveName, saveTC, saveCredits, saveXpMaterials, saveXpPropulsion, saveXpLifeSupport, saveXpElectronics, saveXpAstronomy);
                }
            }
            else
            {
                Debug.LogError("u bad hacker");
            }
        }
コード例 #21
0
ファイル: gameManager.cs プロジェクト: solidcellaMoon/GodBird
    //로드(불러오기) 함수
    public void Load()
    {
        //파일이 없으면 해당위치에 만든다.(첫 실행 시)
        if (!File.Exists(filePath))
        {
            makeD();
        }

        //json값을 읽어와 data 인스턴스에 넣는다.
        string   str  = File.ReadAllText(Application.persistentDataPath + "/clearInfo.json");
        saveData data = JsonUtility.FromJson <saveData>(str);

        //읽어온 정보를 사용되는 스크립트의 변수에 넣어서 업데이트
        itemManager.beanNum   = data.beanNum;
        itemManager.diceNum   = data.diceNum;
        itemManager.birdNum   = data.birdNum;
        dateManager.dateNum   = data.dateNum;
        itemManager.debtNum   = data.debtNum;
        churchManager.chLevel = data.chLevel;
        for (int i = 0; i < 6; i++)
        {
            npcManager.npcGage[i] = data.npcGage[i];
            npcManager.npcEnc[i]  = data.npcEnc[i];
            npcManager.npcList[i] = data.npcList[i];
        }

        tutorialManager.tutorial   = data.tutorial;
        tutorialManager.mgTutorial = data.mgTutorial; // 추가(지현)
        IntroUI.startpanelSee      = data.startpanelSee;

        dateManager.weekNum   = data.weekNum;
        dateManager.gameRetry = data.gameRetry;

        dateManager.decideDebt = data.decideDebt;

        gameManager.gameClear = data.gameClear; // 추가(지현)
        successEvent.ClearNum = data.ClearNum;  // 추가(지현)
    }
コード例 #22
0
    //Load current data from saved data
    private void LoadGameData()
    {
        string filePath = Path.Combine(Application.persistentDataPath, saveName);

        if (File.Exists(filePath))
        {
            string dataJson = File.ReadAllText(filePath);

            saveData loadData = JsonUtility.FromJson<saveData>(dataJson);

            player.gold = loadData.gold;
            player.experience = loadData.exp;
            Upgrade.mAT = loadData.Attack;
            Upgrade.mSH = loadData.Shield;

            player.charHealth = 6;
            player.charShield = Upgrade.mSH;
        }
        else
        {
           Debug.LogError("No Save File");
        }
    }
コード例 #23
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            print("Pressed S");
            saveFile(data1);
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            print("Pressed L");
            print(currentScene.name);
            data1 = loadFile(data1);
            //int currentLevelIndex = 0;//data1.level.FindIndex (c => c.levelName.Equals (currentScene.ToString ()));


            //currentLevelIndex	=  data1.level.FindIndex (x => x.levelName == currentScene.name);
            //currentLevelIndex	=  data1.level.FindIndex (x => x.levelName.Equals(currentScene.name, StringComparison.Ordinal));

            //var ind = data1.level.Find(

            print("Level List index is " + currentLevelIndex + " . Build index is " + currentScene.buildIndex + " . level count is " + data1.level.Count);
            highScoreText.text = "Highscore : " + data1.level[currentLevelIndex].levelHighScore;
        }

        /*if (score == Fish.Count )
         * {
         *      scoreText.text = score + " Eels collected!  You Win!";
         *      gameState = GameState.gameWin;
         * }*/

        if (Input.touchCount == 5 && gameState == GameState.gameWin)
        {
            RestartLevel();
        }
    }
コード例 #24
0
ファイル: SaveManager.cs プロジェクト: 96bp19/FlyHigh
 public static void SaveData(saveData data)
 {
     PlayerPrefs.SetInt(levelCount, data.currentLevel);
 }
コード例 #25
0
    public void Save()
    {
        Debug.Log("saving");

        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/saveinfo.dat");
        saveData        data = new saveData();

        data.allGames  = allGames;
        data.upperarm  = upperarm;
        data.lowerarm  = lowerarm;
        data.lowerleg  = lowerleg;
        data.upperleg  = upperleg;
        data.body      = body;
        data.skintoneR = skintone.r;
        data.skintoneG = skintone.g;
        data.skintoneB = skintone.b;


        data.shoes = this.shoes;
        data.hair  = hair;
        data.hairR = hairColor.r;
        data.hairG = hairColor.g;
        data.hairB = hairColor.b;



        data.selectedBody      = selectedBody;
        data.selectedFace      = selectedFace;
        data.selectedHair      = selectedHair;
        data.unlockedWordList  = unlockedWordList;
        data.allGamesNames     = allGamesNames;
        data.rating            = rating;
        data.competeingRatings = competeingRatings;
        data.competeAgainDate  = competeAgainDate;
        data.isCompeting       = isCompeting;
        data.canCompete        = canCompete;
        data.totalMoney        = totalMoney;
        data.totalMoneyEver    = totalMoneyEver;

        data.gameShopItems        = gameShopItems;
        data.shopItemsCosts       = shopItemsCosts;
        data.moneyClickMultiplier = moneyClickMultiplier;

        data.shopCounts      = shopCounts;
        data.shopItemValue   = shopItemValue;
        data.shopPrices      = shopPrices;
        data.donutsPerSecond = donutsPerSecond;
        data.latestTime      = latestTime;
        data.awardPointCount = awardPointCount;
        //Tier1
        data.buyWord             = buyWord;
        data.placingMedal        = placingMedal;
        data.raising10k          = raising10k;
        data.submitToLeaderboard = submitToLeaderboard;
        //Tier2
        data.placeFirst  = placeFirst;
        data.buyAllWords = buyAllWords;
        data.raise500k   = raise500k;
        //FBLA ULTIMATE MEDAL
        data.FblaExcellenceAward = FblaExcellenceAward;


        bf.Serialize(file, data);
        file.Close();
    }
コード例 #26
0
        // GESTIONE ANALISI DELLA SINGOLA FINESTRA
        private void Analize(double[,,] sampwin, double[,,] quaternioni, int numSensori, string ID, Graph graph, Support help, DateTime startTime)
        {
            // Salvataggio campionamento su CSV
            saveData save = new saveData(help.saveData);

            save.Invoke(sampwin, quaternioni, ID);

            #region Analisi da rappresentare

            for (int s = 0; s < numSensori; s++)
            {
                // Calcolo di Theta: Start
                analizeTurn  analisiGirata   = new analizeTurn(help.FunzioneOrientamento);
                IAsyncResult risultatoGirata = analisiGirata.BeginInvoke(sampwin, s, null, null);

                // Calcolo modulo di accelerometro e giroscopio: Start & End
                double[,] toModule = new double[6, sampwin.GetLength(1)];
                for (int k = 0; k < toModule.GetLength(1); k++)
                {
                    for (int j = 0; j < 6; j++)
                    {
                        toModule[j, k] = sampwin[j, k, s];
                    }
                }
                module       moduleGyrDelegate = new module(Support.computeModule);
                module       moduleAccDelegate = new module(Support.computeModule);
                IAsyncResult risultatoGyr      = moduleGyrDelegate.BeginInvoke(toModule, false, null, null);
                IAsyncResult risultatoAcc      = moduleAccDelegate.BeginInvoke(toModule, true, null, null);

                double[] modgyr = Support.smoothing(moduleGyrDelegate.EndInvoke(risultatoGyr), 10);
                double[] modacc = moduleAccDelegate.EndInvoke(risultatoAcc);

                // Dead Reckoning: Start (non ritorna nulla)
                analizePosition analisiPosizione   = new analizePosition(help.analizePosition);
                IAsyncResult    risultatoPosizione = analisiPosizione.BeginInvoke(quaternioni, modacc, s, null, null);

                modacc = Support.smoothing(modacc, 10);

                // Calcolo di theta: End
                double[] theta = analisiGirata.EndInvoke(risultatoGirata);

                if (s == 0)
                {
                    // Analisi moto-stazionamento su file: Start (non ritorna nulla)
                    movementToFile movementToFile = new movementToFile(help.analisiMovimento);
                    movementToFile.Invoke(modacc, startTime);

                    // Analisi Lay/Stand/Sit su file: Start (non ritorna nulla)
                    analizePostura analisiPostura = new analizePostura(help.analisiPostura);
                    analisiPostura.Invoke(modacc, startTime);

                    // Analisi girate su file: Start (non ritorna nulla)
                    int        lengthTurn = (sampwin.GetLength(1) == 500) ? sampwin.GetLength(1) / 2 : sampwin.GetLength(1);
                    turnToFile turnToFile = new turnToFile(help.analisiTurn);
                    turnToFile.Invoke(theta, lengthTurn, startTime);
                }

                analisiPosizione.EndInvoke(risultatoPosizione);

                // Refresh grafici dopo l'analisi
                switch (s)
                {
                case 0:
                    refreshGraph refreshGraph0 = new refreshGraph(graph.Receive);
                    refreshGraph0.Invoke(modacc, modgyr, theta, help.DRpoints, s);
                    break;

                case 1:
                    refreshGraph refreshGraph1 = new refreshGraph(graph.Receive);
                    refreshGraph1.Invoke(modacc, modgyr, theta, help.DRpoints, s);
                    break;

                case 2:
                    refreshGraph refreshGraph2 = new refreshGraph(graph.Receive);
                    refreshGraph2.Invoke(modacc, modgyr, theta, help.DRpoints, s);
                    break;

                case 3:
                    refreshGraph refreshGraph3 = new refreshGraph(graph.Receive);
                    refreshGraph3.Invoke(modacc, modgyr, theta, help.DRpoints, s);
                    break;

                case 4:
                    refreshGraph refreshGraph4 = new refreshGraph(graph.Receive);
                    refreshGraph4.Invoke(modacc, modgyr, theta, help.DRpoints, s);
                    break;
                }
            }

            #endregion Analisi da rappresentare
        }
コード例 #27
0
    public void SaveLoad()
    {
        if (File.Exists(Application.persistentDataPath + "/saveinfo.dat"))
        {
            Debug.Log("loading");
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/saveinfo.dat", FileMode.Open);
            saveData        data = (saveData)bf.Deserialize(file);
            file.Close();
            topGameName       = data.topGameName;
            topGameIdentifier = data.topGameIdentifier;
            allGames          = data.allGames;
            upperarm          = data.upperarm;
            lowerarm          = data.lowerarm;
            lowerleg          = data.lowerleg;
            upperleg          = data.upperleg;
            body              = data.body;
            skintone          = new Color(data.skintoneR, data.skintoneG, data.skintoneB, 1f);
            shoes             = data.shoes;
            hair              = data.hair;
            hairColor         = new Color(data.hairR, data.hairG, data.hairB, 1f);
            gameShopItems     = data.gameShopItems;
            shopItemsCosts    = data.shopItemsCosts;
            selectedBody      = data.selectedBody;
            selectedFace      = data.selectedFace;
            selectedHair      = data.selectedHair;
            unlockedWordList  = data.unlockedWordList;
            allGamesNames     = data.allGamesNames;
            rating            = data.rating;
            competeingRatings = data.competeingRatings;
            competeAgainDate  = data.competeAgainDate;
            isCompeting       = data.isCompeting;
            canCompete        = data.canCompete;
            totalMoney        = data.totalMoney;
            totalMoneyEver    = data.totalMoneyEver;


            moneyClickMultiplier = data.moneyClickMultiplier;

            shopCounts      = data.shopCounts;
            shopItemValue   = data.shopItemValue;
            shopPrices      = data.shopPrices;
            donutsPerSecond = data.donutsPerSecond;
            latestTime      = data.latestTime;

            awardPointCount = data.awardPointCount;

            //Tier1
            buyWord             = data.buyWord;
            placingMedal        = data.placingMedal;
            raising10k          = data.raising10k;
            submitToLeaderboard = data.submitToLeaderboard;
            //Tier2
            placeFirst  = data.placeFirst;
            buyAllWords = data.buyAllWords;
            raise500k   = data.raise500k;
            //FBLA ULTIMATE MEDAL
            FblaExcellenceAward = data.FblaExcellenceAward;
        }
        else
        {
            Debug.Log("saving");

            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Create(Application.persistentDataPath + "/saveinfo.dat");
            saveData        data = new saveData();
            data.topGameIdentifier = topGameIdentifier;
            data.topGameName       = topGameName;
            data.allGames          = allGames;
            data.upperarm          = upperarm;
            data.lowerarm          = lowerarm;
            data.lowerleg          = lowerleg;
            data.upperleg          = upperleg;
            data.body           = body;
            data.skintoneR      = skintone.r;
            data.skintoneG      = skintone.g;
            data.skintoneB      = skintone.b;
            data.gameShopItems  = gameShopItems;
            data.shopItemsCosts = shopItemsCosts;

            data.shoes           = this.shoes;
            data.hair            = hair;
            data.hairR           = hairColor.r;
            data.hairG           = hairColor.g;
            data.hairB           = hairColor.b;
            data.awardPointCount = awardPointCount;
            //Tier1
            data.buyWord             = buyWord;
            data.placingMedal        = placingMedal;
            data.raising10k          = raising10k;
            data.submitToLeaderboard = submitToLeaderboard;
            //Tier2
            data.placeFirst  = placeFirst;
            data.buyAllWords = buyAllWords;
            data.raise500k   = raise500k;
            //FBLA ULTIMATE MEDAL
            data.FblaExcellenceAward = FblaExcellenceAward;



            data.selectedBody      = selectedBody;
            data.selectedFace      = selectedFace;
            data.selectedHair      = selectedHair;
            data.unlockedWordList  = unlockedWordList;
            data.allGamesNames     = allGamesNames;
            data.rating            = rating;
            data.competeingRatings = competeingRatings;
            data.competeAgainDate  = competeAgainDate;
            data.isCompeting       = isCompeting;
            data.canCompete        = canCompete;
            data.totalMoney        = totalMoney;
            data.totalMoneyEver    = totalMoneyEver;

            data.moneyClickMultiplier = moneyClickMultiplier;

            data.shopCounts      = shopCounts;
            data.shopItemValue   = shopItemValue;
            data.shopPrices      = shopPrices;
            data.donutsPerSecond = donutsPerSecond;
            data.latestTime      = latestTime;


            bf.Serialize(file, data);
            file.Close();
        }
    }
コード例 #28
0
 public void QuickSave(saveData data)
 {
     throw new NotImplementedException();
 }
コード例 #29
0
ファイル: FormMain.cs プロジェクト: skyang7652/ProjectPhoto
        private List<saveData> changeToSaveData(List<data> dataList)
        {
            List<saveData> tempData = new List<saveData>();
            foreach (data i in dataList)
            {

                saveData temp = new saveData();

                temp.imageData = ImageToBuffer(i.imageData, ImageFormat.Jpeg);
                temp.oriImage = ImageToBuffer(i.oriImage, ImageFormat.Jpeg);
                temp.title = i.title;
                temp.des = i.des;
                temp.filePath = i.filePath;
                temp.date = i.date;
                tempData.Add(temp);
            }

            return tempData;
        }
コード例 #30
0
    public void drawPanel()
    {
        for (int i = 0; i < optionNum; i++)
        {
            files[i].text = "* File " + (optionNum * nowPage + i + 1);
        }

        if (gameManager.instance.player == null)
        {
            texts[2].text.transform.parent.GetComponent <Button>().interactable = false;
        }
        else
        {
            texts[2].text.transform.parent.GetComponent <Button>().interactable = true;
        }

        string fileName = "file" + (optionNum * nowPage + cursorPos + 1);
        string filePath = Application.dataPath + @"/Save/" + fileName + ".json";

        if (System.IO.File.Exists(filePath))
        {
            texts[1].text.transform.parent.GetComponent <Button>().interactable = true;
            texts[3].text.transform.parent.GetComponent <Button>().interactable = true;

            string   txt  = File.ReadAllText(filePath);
            saveData data = JsonMapper.ToObject <saveData>(txt);

            double playTime = data.playTime;

            //地图名字
            infos[0].text = findText(data.mapName, gameManager.instance.setting.nowlang);
            // 游戏时间
            int hour   = (int)playTime / 3600;
            int minute = ((int)playTime - hour * 3600) / 60;
            int second = (int)playTime - hour * 3600 - minute * 60;
            infos[1].text = string.Format("{0:D2}:{1:D2}:{2:D2}", hour, minute, second);
            // 人物头像
            for (int i = 0; i < avators.Length; i++)
            {
                if (i < data.team.Count)
                {
                    avators[i].sprite = dataManager.instance.playerInfos[data.team[i]].face;
                }
                else
                {
                    avators[i].sprite = UIMask;
                }
            }
        }
        else
        {
            texts[1].text.transform.parent.GetComponent <Button>().interactable = false;
            texts[3].text.transform.parent.GetComponent <Button>().interactable = false;
            infos[0].text = "empty";
            infos[1].text = "empty";
            for (int i = 0; i < avators.Length; i++)
            {
                avators[i].sprite = UIMask;
            }
        }
    }
コード例 #31
0
            public List <cart> Get()
            {
                iReadAllData readObject = new saveData();

                return(readObject.GetAllItems());
            }
コード例 #32
0
ファイル: gamelogic.cs プロジェクト: mwebi/Blocky
    // Use this for initialization
    void Start()
    {
        player1 = GameObject.Find("player1");
        player1Script = player1.GetComponent<PlayerScript>();

        player2 = GameObject.Find("player2");
        player2Script = player2.GetComponent<PlayerScript>();

        activePlayer = player1;

        comboText = GameObject.Find("ComboText").GetComponent<TextMesh>();
        resultText = GameObject.Find("ResultText");

        foreach (GameObject cube in player1Blocks) {
            cube.GetComponent<Cube>().playerThisCubeBelongsTo = player1;
        }
        foreach (GameObject cube in player2Blocks) {
            cube.GetComponent<Cube>().playerThisCubeBelongsTo = player2;
        }

        GameObject.Find("ScoreNeeded").GetComponent<TextMesh>().text = "Score needed to win: " + MaxScore;

        if(AutoMode){
            GameObject.Find("ResetButton").SetActiveRecursively(false);
        }

        if(GameObject.Find("dataObjectOriginal") != null)
            dataObject = GameObject.Find("dataObjectOriginal").GetComponent<saveData>();
        else
            dataObject = GameObject.Find("dataObject").GetComponent<saveData>();

        //if(dataObject.isCopy)
            //dataObject = GameObject.Find("dataObjectOriginal").GetComponent<saveData>();
        //if(dataObject ==null)
            //dataObject = GameObject.Find("dataObjectOriginal").GetComponent<saveData>();

        //if(dataObject.firstRound && dataObject.gameObject.name != "dataOb)
            //Destroy(dataObject.gameObject);
        gameEnded = false;
    }