Esempio n. 1
0
    ///マスのデータを読み込む
    static public Arg loadMasData(string aFileName, int aX, int aY)
    {
        string tKey = aX.ToString() + "," + aY.ToString();

        //地形データファイル読み込み
        if (!mSpriteData.ContainsKey(aFileName))
        {
            mSpriteData[aFileName] = new Arg(MyJson.deserializeResourse(kDirPath + "/" + aFileName + "C"));
        }
        return(mSpriteData[aFileName].get <Arg>(tKey));
    }
Esempio n. 2
0
    public StageData(string aFilePath)
    {
        mData = new Arg(MyJson.deserializeResourse("stage/data/" + aFilePath));
        //マスデータ
        List <Mas> tMasList = new List <Mas>();
        List <Arg> tMasData = mData.get <List <Arg> >("mas");

        foreach (Arg tData in tMasData)
        {
            Mas tMas = Mas.create(tData);
            tMasList.Add(tMas);
        }
        mData.set("mas", tMasList);
    }
Esempio n. 3
0
    static public MapObject create(string aFileName, string aName, string id = "")
    {
        if (!mObjectDatas.ContainsKey(aFileName))
        {
            mObjectDatas[aFileName] = new Arg(MyJson.deserializeResourse(MapObjectCreater.kDirPath + "/" + aFileName));
        }
        Arg       tObjectData = mObjectDatas[aFileName].get <Arg>(aName);
        MapObject tMapObject  = MyBehaviour.create <MapObject>();

        tMapObject.name = (id == "") ? aName : aFileName;
        //sprite
        if (tObjectData.ContainsKey("sprite"))
        {
            //画像があるフォルダのパス
            string tPath = HandleString.cutOff(aFileName, "/");
            tPath = (tPath == "") ? MapObjectCreater.kDirPath : MapObjectCreater.kDirPath + "/" + tPath;
            Arg tData = tObjectData.get <Arg>("sprite");
            //pivotYが設定されていないなら0に設定
            if (!tData.ContainsKey("pivotY"))
            {
                tData.set("pivotY", 0f);
            }
            //スプライトセット
            ChildSprite.addSpriteObject(tMapObject.gameObject, tData, tPath);
        }
        //zIndex
        if (tObjectData.ContainsKey("zIndex"))
        {
            tMapObject.zIndex = tObjectData.get <float>("zIndex");
        }
        //マップ属性
        if (tObjectData.ContainsKey("attribute"))
        {
            tMapObject.gameObject.AddComponent <MapAttributeBehaviour>().setAttribute(tObjectData.get <string>("attribute"));
        }
        //collider設定
        if (tObjectData.ContainsKey("collider"))
        {
            Arg tColliderData = tObjectData.get <Arg>("collider");
            ColliderInstaller.addCollider(tMapObject.gameObject, tObjectData.get <Arg>("collider"));
        }
        //category
        if (tObjectData.ContainsKey("category"))
        {
        }
        return(tMapObject);
    }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        Arg           aData      = new Arg(MyJson.deserializeResourse("stage/stage"));
        List <string> tStageList = aData.get <List <string> >("stageList");
        MyButton      tPrefab    = Resources.Load <MyButton>("prefab/selectStage/element");

        for (int i = 0; i < tStageList.Count; i++)
        {
            string   tStagePath = tStageList[i];
            MyButton tButton    = GameObject.Instantiate(tPrefab);
            tButton.mParameters = new Arg(new Dictionary <string, object> {
                { "filePath", tStagePath }
            });
            tButton.position = new Vector3(0, -i, -10);
            tButton.transform.SetParent(this.transform, false);
            StageData tStageData = new StageData(tStagePath);
            tButton.GetComponentInChildren <TextMesh>().text = tStageData.mName;
        }
    }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        mArg             = MySceneManager.getArg("game");
        mSetting         = mArg.get <GameSetting>("setting");
        mStageData       = new Arg(MyJson.deserializeResourse("stage/data/" + mSetting.mStageName));
        mFeeRate         = mSetting.mFeeRate;
        mAcquisitionRate = mSetting.mAcqusitionRate;

        GameFeild           tFeild  = GameFeildFactory.create(mStageData);
        List <PlayerStatus> tStatus = PlayerFactory.create(mSetting, tFeild, mStageData);

        MySceneManager.openScene("playerStatus", null, (aScene) => {
            PlayerStatusMain tMain = GameObject.Find("playerStatusMain").GetComponent <PlayerStatusMain>();
            tMain.initialize(tStatus);
            mMaster         = new GameMaster();
            mMaster.mCamera = GameObject.Find("gameMainCamera").GetComponent <GameMainCamera>();
            mMaster.start(tFeild, tStatus, tMain);
        });
    }
Esempio n. 6
0
    //設定内容を表示
    void setSetting(GameSetting aSetting)
    {
        setCharaSetting(aSetting.mCharaData1, GameObject.Find("charaData1").GetComponent <MyBehaviour>());
        setCharaSetting(aSetting.mCharaData2, GameObject.Find("charaData2").GetComponent <MyBehaviour>());
        setCharaSetting(aSetting.mCharaData3, GameObject.Find("charaData3").GetComponent <MyBehaviour>());
        setCharaSetting(aSetting.mCharaData4, GameObject.Find("charaData4").GetComponent <MyBehaviour>());
        GameObject.Find("initialMoneyRate").GetComponent <TextMesh>().text = "x" + aSetting.mInitialMoneyRate.ToString();
        GameObject.Find("feeRate").GetComponent <TextMesh>().text          = "x" + aSetting.mFeeRate.ToString();
        if (aSetting.mAcqusitionRate <= 0)
        {
            GameObject.Find("acquisitionRate").GetComponent <TextMesh>().text = "なし";
        }
        else
        {
            GameObject.Find("acquisitionRate").GetComponent <TextMesh>().text = "x" + aSetting.mAcqusitionRate.ToString();
        }
        Arg tStageData = new Arg(MyJson.deserializeResourse("stage/data/" + aSetting.mStageName));

        GameObject.Find("stageName").GetComponent <TextMesh>().text = tStageData.get <string>("name");
    }
Esempio n. 7
0
    static public LocalMap create(string aMapName)
    {
        //マップデータロード
        Arg tMapData = new Arg(MyJson.deserializeResourse("Database/map/" + aMapName));
        List <List <int> > tTroutData = tMapData.get <List <List <int> > >("feild");
        Arg tChipData = tMapData.get <Arg>("chip");

        int tWidth  = tTroutData[0].Count;
        int tHeight = tTroutData.Count;

        MapTrout[,] tTrouts = new MapTrout[tWidth, tHeight];

        //マス
        List <MapCharacter> tCharacters = new List <MapCharacter>();
        GameObject          tTiles      = GameObject.Find("mapTiles");

        for (int tX = 0; tX < tWidth; tX++)
        {
            for (int tY = 0; tY < tHeight; tY++)
            {
                string     tChipNum = tTroutData[tY][tX].ToString();
                List <Arg> tChip    = tChipData.get <List <Arg> >(tChipNum);
                MapTrout   tTrout   = MapTroutCreater.create(tChip);
                tTrout.transform.parent = tTiles.transform;
                tTrout.mapPosition      = new Vector2(tX, tY);
                tTrout.name             = "(" + tX.ToString() + "," + tY.ToString() + ")";
                tTrouts[tX, tY]         = tTrout;
            }
        }
        //オブジェクト
        List <MapObject> tObjects  = new List <MapObject>();
        GameObject       tSpeakers = GameObject.Find("mapSpeakers");

        foreach (Arg tObjectData in tMapData.get <List <Arg> >("object"))
        {
            MapObject tObject = MapObjectCreater.create(tObjectData.get <string>("file"), tObjectData.get <string>("name"));
            tObject.mapPosition = new Vector2(tObjectData.get <float>("x"), tObjectData.get <float>("y"));
            if (tObjectData.ContainsKey("z"))
            {
                tObject.zIndex = tObjectData.get <float>("z");
            }
            tObject.transform.parent = tSpeakers.transform;
            tObjects.Add(tObject);
            //searchEvent
            if (tObjectData.ContainsKey("search"))
            {
                MapSearchedBehaviour tSearched = tObject.gameObject.AddComponent <MapSearchedBehaviour>();
                Arg tEvent = tMapData.get <Arg>("argument").get <Arg>(tObjectData.get <string>("search"));
                tSearched.setSearchedEvent(tEvent);
            }
            //子オブジェクト
        }
        LocalMap tMap = new LocalMap(tTrouts, tCharacters, tObjects, new List <MapEventTrigger>());
        //イベント
        List <MapEventTrigger> tTriggers = new List <MapEventTrigger>();
        GameObject             tEvents   = GameObject.Find("mapEvents");

        foreach (Arg tEventData in tMapData.get <List <Arg> >("event"))
        {
            MapEventTrigger tTrigger = MapEventTriggerCreater.create(tEventData);
            tTrigger.mapPosition      = new Vector2(tEventData.get <float>("x"), tEventData.get <float>("y"));
            tTrigger.transform.parent = tEvents.transform;
            tMap.addEventTrigger(tTrigger);
        }
        return(tMap);
    }