Exemplo n.º 1
0
        void SetupSlot(PlayerType playerType)
        {
            var slotController = EditContext.instance.Controller.GetSlotController(playerType);

            slotController.RemoveAll();

            var komaTypeArray = Enum.GetValues(typeof(KomaType)).Cast <KomaType>();

            foreach (var komaType in komaTypeArray)
            {
                if (komaType == KomaType.None)
                {
                    continue;
                }
                var initData = new Koma.InitData();
                initData.Type       = komaType;
                initData.Lv         = 1;
                initData.PlayerType = playerType;
                var newKoma = EditContext.instance.Controller.KomaFactory.Create(initData);
                slotController.Add(newKoma);
            }

            slotController.OnSelect = (koma) => {
                var otherSlotContrller = EditContext.instance.Controller.GetOtherSlotController(playerType);
                otherSlotContrller.ResetSelect();
                this.komaType   = koma.Type;
                this.playerType = koma.PlayerType;
            };
        }
Exemplo n.º 2
0
 public Place(Koma.InitData data, PlayerType playerType)
 {
     Position   = data.InitPosition;
     KomaType   = data.Type;
     Lv         = data.Lv;
     PlayerType = playerType;
 }
Exemplo n.º 3
0
    public Koma Create(Koma.InitData param)
    {
        var koma = _container.InstantiatePrefabForComponent <Koma>(_komaPrefab.gameObject, _uiBoard.KomaParent);

        koma.Init(param);
        Debug.Log("Create! ; " + koma);
        return(koma);
    }
Exemplo n.º 4
0
    protected override void OnEnter()
    {
        foreach (var place in Owner.PlaceData.placeList)
        {
            var initData = new Koma.InitData(place);
            var koma     = Owner.KomaFactory.Create(initData);
            Owner.KomaManager.Add(koma);
        }

        Owner.ChangeState <GameStateSelect>();
    }
Exemplo n.º 5
0
 void Place(PlaceData data)
 {
     foreach (var place in data.placeList)
     {
         var initData = new Koma.InitData();
         initData.Type         = place.KomaType;
         initData.Lv           = place.Lv;
         initData.InitPosition = place.Position;
         initData.PlayerType   = place.PlayerType;
         var newKoma = EditContext.instance.Controller.KomaFactory.Create(initData);
         komaList.Add(newKoma);
     }
 }
Exemplo n.º 6
0
        void OnSelect(Vector2Int position)
        {
            if (komaType == KomaType.None || playerType == PlayerType.None)
            {
                return;
            }

            var koma     = komaList.FirstOrDefault(k => k.Position == position);
            var initData = new Koma.InitData();

            if (koma == null)
            {
                initData.Type         = komaType;
                initData.Lv           = 1;
                initData.InitPosition = position;
                initData.PlayerType   = playerType;
                var newKoma = EditContext.instance.Controller.KomaFactory.Create(initData);
                komaList.Add(newKoma);
            }
            else
            {
                if (EditContext.instance.Controller.FixedDataManager.KomaDataProvider.GetMaxLv(koma.Type) == koma.Lv)
                {
                    komaList.Remove(koma);
                    GameObject.Destroy(koma.gameObject);
                }
                else
                {
                    initData.Type         = koma.Type;
                    initData.Lv           = koma.Lv + 1;
                    initData.InitPosition = koma.Position;
                    initData.PlayerType   = koma.PlayerType;
                    koma.Init(initData);
                }
            }
        }