private BoardState LoadUpdatedBoardState()
        {
            CardLoader.ResetIds();
            var chips    = ChipLoader.LoadChips(Rarity.None);
            var spaces   = SpaceLoader.LoadSpaces();
            var trainers = TrainerLoader.LoadTrainers();
            var items    = CardLoader.LoadItems();
            var events   = CardLoader.LoadEvents();
            var elites   = EliteLoader.LoadElites();

            var boardStateData = LoadBoardState();
            var catchSpaceData = LoadCatchSpaces();
            var chipData       = LoadChips();
            var playerData     = LoadPlayers();
            var spaceData      = LoadSpaces();
            var trainerData    = LoadTrainers();

            UpdateTrainers(trainers, trainerData);
            UpdateChips(chips, chipData);
            UpdateSpaces(spaces, spaceData, catchSpaceData, chips);

            var players = CreatePlayers(playerData, trainers, chips, items, spaces.Item1);

            return(CreateBoardState(boardStateData, chips, items, events, players, spaces, elites));
        }
Example #2
0
    public override void initImage(Arg aArg, string aDirectory)
    {
        createChild();
        mTileList = new List <MapTile>();
        string tFileName = aDirectory + "/" + aArg.get <string>("file");
        List <List <List <int> > > tTileData = aArg.get <List <List <List <int> > > >("tiles");
        float tWidth  = tTileData[0].Count;
        float tHeight = tTileData.Count;

        for (int tY = 0; tY < tTileData.Count; tY++)
        {
            List <List <int> > tLine = tTileData[tY];
            for (int tX = 0; tX < tLine.Count; tX++)
            {
                List <int> tChip = tLine[tX];
                if (tChip[0] == -1)
                {
                    continue;
                }
                Sprite  tSprite = ChipLoader.load(tFileName, tChip[0], tChip[1]);
                MapTile tTile   = MyBehaviour.create <MapTile>();
                tTile.init(tSprite, new MapBehaviourAttribute(MapBehaviourAttribute.Attribute.accessory));
                tTile.transform.position = new Vector3(tX - tWidth / 2 + 0.5f, tHeight - tY - 0.5f, 0);
                mTileList.Add(tTile);
                tTile.gameObject.transform.SetParent(mChild.transform, false);
            }
        }
    }
Example #3
0
    public static void LoadAll(Manager manager)
    {
        // Load any saved chips
        var sw = System.Diagnostics.Stopwatch.StartNew();

        ChipLoader.LoadAllChips(GetChipSavePaths(), manager);
        Debug.Log("Load time: " + sw.ElapsedMilliseconds);
    }
Example #4
0
    public void ViewChip(Chip chip)
    {
        LoadNewEditor();
        UIManager.ChangeState(UIManagerState.Update);

        ChipSaveData chipSaveData = ChipLoader.GetChipSaveData(chip, builtinChips, spawnableChips, wirePrefab, activeChipEditor);

        activeChipEditor.LoadFromSaveData(chipSaveData);
    }
Example #5
0
    public static void LoadAll(Manager manager)
    {
        // Load any saved chips
        var sw            = System.Diagnostics.Stopwatch.StartNew();
        var chipSavePaths = Directory.GetFiles(CurrentSaveProfileDirectoryPath, "*" + fileExtension);

        ChipLoader.LoadAllChips(chipSavePaths, manager);
        Debug.Log("Load time: " + sw.ElapsedMilliseconds);
    }
    void ImportChip()
    {
        var extensions = new[] {
            new ExtensionFilter("Chip design", "dls"),
        };


        StandaloneFileBrowser.OpenFilePanelAsync("Import chip design", "", extensions, true, (string[] paths) => {
            if (paths[0] != null && paths[0] != "")
            {
                ChipLoader.Import(paths[0]);
                EditChipBar();
            }
        });
    }
    public void Load(string chipName, GameObject chipHolder)
    {
        var loadedChip = Instantiate(chipHolder);

        loadedChip.transform.parent = transform;

        List <Chip> topLevelChips = new List <Chip> (GetComponentsInChildren <Chip> ());

        var subChips = GetComponentsInChildren <CustomChip> (includeInactive: true);

        for (int i = 0; i < subChips.Length; i++)
        {
            if (subChips[i].transform.parent == loadedChip.transform)
            {
                subChips[i].gameObject.SetActive(true);
                topLevelChips.Add(subChips[i]);
            }
        }

        //topLevelChips.Sort ((a, b) => a.chipSaveIndex.CompareTo (b.chipSaveIndex));

        var wiringSaveData = ChipLoader.LoadWiringFile(SaveSystem.GetPathToWireSaveFile(chipName));
        int wireIndex      = 0;

        foreach (var savedWire in wiringSaveData.serializableWires)
        {
            Wire loadedWire = GameObject.Instantiate(wirePrefab, parent: loadedChip.transform);
            loadedWire.SetDepth(wireIndex);
            Pin parentPin = topLevelChips[savedWire.parentChipIndex].outputPins[savedWire.parentChipOutputIndex];
            Pin childPin  = topLevelChips[savedWire.childChipIndex].inputPins[savedWire.childChipInputIndex];
            loadedWire.Connect(parentPin, childPin);
            loadedWire.SetAnchorPoints(savedWire.anchorPoints);
            FindObjectOfType <PinAndWireInteraction> ().LoadWire(loadedWire);
            //player.AddWire (loadedWire);

            if (childPin.chip is Bus)
            {
                childPin.transform.position = savedWire.anchorPoints[savedWire.anchorPoints.Length - 1];
            }
            if (parentPin.chip is Bus)
            {
                parentPin.transform.position = savedWire.anchorPoints[0];
            }
            wireIndex++;
        }

        this.loadedChipHolder = loadedChip;
    }
    public override void initImage(Arg aArg, string aDirectory)
    {
        createChild();
        float tWidth  = (aArg.ContainsKey("width")) ? aArg.get <float>("width") : 1;
        float tHeight = (aArg.ContainsKey("height")) ? aArg.get <float>("height") : 1;
        //画像のpivot
        Vector2 tPivot = new Vector2(aArg.ContainsKey("pivotX") ? aArg.get <float>("pivotX") : 0.5f,
                                     aArg.ContainsKey("pivotY") ? (aArg.get <float>("pivotY")) : 0.5f);
        //画像読み込み
        Sprite tSprite = ChipLoader.load(aDirectory + "/" + aArg.get <string>("file"), aArg.get <int>("x"), aArg.get <int>("y"),
                                         tWidth, tHeight, tPivot);
        //画像表示用の子ノード生成
        GameObject tSpriteNode = MyBehaviour.create <MyBehaviour>().gameObject;

        tSpriteNode.transform.SetParent(mChild.transform, false);
        mRenderer        = tSpriteNode.AddComponent <SpriteRenderer>();
        mRenderer.sprite = tSprite;
    }
Example #9
0
    public override void initImage(Arg aArg, string aDirectory)
    {
        createChild();
        mAnimator = MyBehaviour.create <GifAnimator>();
        mAnimator.gameObject.transform.SetParent(mChild.transform, false);
        Arg tAnimationData = aArg.get <Arg>("animation");

        //更新インターバル
        mAnimator.setInterval(tAnimationData.get <float>("interval"));
        //画像のpivot
        Vector2 tPivot = new Vector2(aArg.ContainsKey("pivotX") ? aArg.get <float>("pivotX") : 0.5f,
                                     aArg.ContainsKey("pivotY") ? (aArg.get <float>("pivotY")) : 0.5f);
        //画像
        List <Sprite> tSprites = new List <Sprite>();

        if (tAnimationData.ContainsKey("tile"))//コマを座標指定
        {
            int tWidth  = (aArg.ContainsKey("width")) ? aArg.get <int>("width") : 1;
            int tHeight = (aArg.ContainsKey("height")) ? aArg.get <int>("height") : 1;
            foreach (List <int> tXY in tAnimationData.get <List <List <int> > >("tile"))
            {
                tSprites.Add(ChipLoader.load(aDirectory + "/" + aArg.get <string>("file"), tXY[0], tXY[1], tWidth, tHeight));
            }
        }
        else if (tAnimationData.get <string>("direction") == "horizontal")//コマが横方向
        {
            for (int i = 0; i < tAnimationData.get <int>("frame"); i++)
            {
                tSprites.Add(ChipLoader.load(aDirectory + "/" + aArg.get <string>("file"), aArg.get <int>("x") + i * aArg.get <int>("width"), aArg.get <int>("y"),
                                             aArg.get <int>("width"), aArg.get <int>("height"), tPivot));
            }
        }
        else  //コマが縦方向
        {
            for (int i = 0; i < tAnimationData.get <int>("frame"); i++)
            {
                tSprites.Add(ChipLoader.load(aDirectory + "/" + aArg.get <string>("file"), aArg.get <int>("x"), aArg.get <int>("y") + i * aArg.get <int>("height"),
                                             aArg.get <int>("width"), aArg.get <int>("height"), tPivot));
            }
        }
        mAnimator.setSprites(tSprites);
        mAnimator.play();
    }
        private static BoardState LoadNewBoardState()
        {
            var boardState = new BoardState
            {
                PinkChips   = ChipLoader.LoadChips(Rarity.Pink),
                GreenChips  = ChipLoader.LoadChips(Rarity.Green),
                BlueChips   = ChipLoader.LoadChips(Rarity.Blue),
                RedChips    = ChipLoader.LoadChips(Rarity.Red),
                YellowChips = ChipLoader.LoadChips(Rarity.Yellow),
                ItemCards   = CardLoader.LoadItems(),
                EventCards  = CardLoader.LoadEvents()
            };

            var spaceLoad = SpaceLoader.LoadSpaces();

            boardState.Spaces         = spaceLoad.Item1;
            boardState.PalletTown     = spaceLoad.Item2;
            boardState.CinnabarIsland = spaceLoad.Item3;
            boardState.IndigoArrival  = spaceLoad.Item4;

            boardState.EliteTrainers = EliteLoader.LoadElites();

            return(boardState);
        }
Example #11
0
 public static List <Chip> LoadChips(Rarity rarity)
 {
     return(ChipLoader.LoadChips(rarity));
 }
Example #12
0
 public static SavedChip[] GetAllSavedChips()
 {
     // Load any saved chips
     return(ChipLoader.GetAllSavedChips(GetChipSavePaths()));
 }