Beispiel #1
0
    public void EnableChoice()
    {
        CurStep          = eCHOICE_STEP.None;
        ViewSelectIndex  = -1;
        ThrowSelectIndex = -1;
        gameObject.SetActive(true);
        ThrowText.SetActive(true);
        OpenText.SetActive(false);

        for (int i = CardList.Count - 1; i >= 0; --i)
        {
            Destroy(CardList[i].gameObject);
        }
        CardList.Clear();

        PlayerBase player = GameSingleton.GetPlay().ToSevenPoker().GetMyPlayer();
        var        list   = player.CardList;

        assert.set(list.Count == 4);
        for (int i = 0; i < list.Count; ++i)
        {
            CardInfo_Trump info = new CardInfo_Trump();
            info.Clone(list[i]);
            info.EnableSelectBtn = true;

            Card_Base cardClass = GameSingleton.GetPlay().CreateCard(CardSetTr, info);
            cardClass.SetSelectBtnDelegate(OnClick_ChoiceCard, i);
            cardClass.ToTrump().SetBackBtnDelegate(OnClick_ChoiceCard, i);
            CardList.Add(cardClass);
        }
    }
Beispiel #2
0
    public void SetStep_Board(PlayTypes.SevenPokerStep step)
    {
        switch (step)
        {
        case PlayTypes.SevenPokerStep.Begin:
        {
            ChoiceCard.DisableChoice();
        }
        break;

        case PlayTypes.SevenPokerStep.ChoiceCardShare_Complete:
        {
            if (GameSingleton.GetPlay().IsObserverMode() == false)
            {
                ChoiceCard.EnableChoice();
            }
        }
        break;

        case PlayTypes.SevenPokerStep.ChoiceCardSelect:
        {
            ChoiceCard.DisableChoice();
        }
        break;
        }
    }
Beispiel #3
0
	public void StartSpawning(GameSingleton game) {
		EncounterNo++;
		this._enemiesSpawned = 0;
		this._enemiesToSpawn = MAX_ENEMIES;
		this.InProgress = true;

		game.StartCoroutine (SpawnEnemy ());
//		List<GameObject> result = new List<GameObject> ();
//
//		int noOfEnemies = Mathf.Max(MaxEnemies, EncounterNo);
//		int hpLevel = 1;
//		int lowerHpLevel = 4;
//		if (EncounterNo > MaxEnemies) {
//			hpLevel = EncounterNo / MaxEnemies;
//			lowerHpLevel = EncounterNo % MaxEnemies;					
//		}
//		for (int i = 0; i < noOfEnemies; i++) {
//			GameObject enemy = Object.Instantiate (EnemyPrefab);
//			result.Add (enemy);
//			float yOffset = extends.y - 1f * (i + 1);
//			enemy.transform.position = 
//				new Vector3 (cam.transform.position.x + extends.x - 1f, cam.transform.position.y + yOffset , 0);
//			enemy.GetComponent<HealthComponent> ().CurrentHealth = hpLevel * MIN_HP;
//			enemy.GetComponent<HealthComponent> ().MaxHealth = hpLevel * MIN_HP;
//		}
//		return result;
	}
Beispiel #4
0
    // Use this for initialization
    virtual protected void Start()
    {
        RectTransform rt = GetComponent <RectTransform>();

        rt.sizeDelta = GameSingleton.GetPlay().CardSize;

        _ApplyCardInfo();
    }
Beispiel #5
0
 void OnDestroy()
 {
     GameSingleton._GameService.RemoveCallback <UDPFrameData>(OnProcessMsg);
     GameSingleton._GameService.RemoveCallback <UDPMoveStart>(OnProcessMsg);
     GameSingleton._GameService.RemoveCallback <UDPMoveEnd>(OnProcessMsg);
     GameSingleton._GameService.RemoveCallback <UDPChangeDir>(OnProcessMsg);
     GameSingleton._GameService.RemoveCallback <UDPReleaseSkill>(OnProcessMsg);
     GameSingleton.Clear();
 }
Beispiel #6
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != null)
     {
         Debug.Log("more than one singleton.");
     }
 }
Beispiel #7
0
    public void OnClick_ChoiceCard(int ChoiceIndex)
    {
        assert.set(ChoiceIndex < 4);
        assert.set(ChoiceIndex >= 0);

        switch (CurStep)
        {
        case eCHOICE_STEP.None:
        {
            CurStep          = eCHOICE_STEP.ThrowSelect;
            ThrowSelectIndex = ChoiceIndex;

            Card_Base cardClass = CardList[ChoiceIndex];

            cardClass.SetCardView(PlayTypes.CardView.Back);
            cardClass.SetEnableSelectBtn(false);
            cardClass.ToTrump().SetEnableBackBtn(true);

            ThrowText.SetActive(false);
            OpenText.SetActive(true);
        }
        break;

        case eCHOICE_STEP.ThrowSelect:
        {
            if (ThrowSelectIndex == ChoiceIndex)
            {
                Card_Base cardClass = CardList[ChoiceIndex];
                cardClass.SetCardView(PlayTypes.CardView.Front);
                cardClass.SetEnableSelectBtn(true);
                cardClass.ToTrump().SetEnableBackBtn(false);

                ThrowText.SetActive(true);
                OpenText.SetActive(false);

                CurStep          = eCHOICE_STEP.None;
                ThrowSelectIndex = -1;
            }
            else
            {
                CurStep         = eCHOICE_STEP.ViewSelect;
                ViewSelectIndex = ChoiceIndex;

                // 버리고 나서의 선택카드 인덱싱 - 서버 전달 헷갈리지 말자
                if (ViewSelectIndex > ThrowSelectIndex)
                {
                    --ViewSelectIndex;
                }
                GameSingleton.GetPlay().ToSevenPoker().Send_ChoiceComplete(ThrowSelectIndex, ViewSelectIndex);
            }
        }
        break;
        }
    }
Beispiel #8
0
    //Functions

    private void Start()
    {
        if (Instance != null)
        {
            Destroy(this);
        }
        else
        {
            Instance = this;
        }
    }
 // OpenCardIndex 는 ThrowCardIndex 버리고 나서의 인덱스 계산
 public void Send_ChoiceComplete(int ThrowCardIndex, int OpenCardIndex)
 {
     if (IsOnline() == false)
     {
         int PlayerIndex = GameSingleton.GetPlay().ToSevenPoker().GetMyPlayer().GetPlayerIndex();
         Recv_UserChoiceComplete(PlayerIndex, ThrowCardIndex, OpenCardIndex);
     }
     else
     {
     }
 }
Beispiel #10
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else if (instance != null)
     {
         Debug.Log("more than one singleton.");
     }
 }
Beispiel #11
0
 void Awake()
 {
     GameSingleton.Init();
     GameSingleton._GameService.AddCallback <UDPMoveStart>(OnProcessMsg);
     GameSingleton._GameService.AddCallback <UDPMoveEnd>(OnProcessMsg);
     GameSingleton._GameService.AddCallback <UDPChangeDir>(OnProcessMsg);
     GameSingleton._GameService.AddCallback <UDPReleaseSkill>(OnProcessMsg);
     GameSingleton._GameService.AddCallback <UDPFrameData>(OnProcessMsg);
     GameSingleton._GameService.Send(new UDPGameStart {
         UserId = Facade.Instance.LocalPlayerUserId
     });
 }
Beispiel #12
0
    private void Awake()
    {
        m_instance    = this;
        _lastTick     = Time.realtimeSinceStartup + StartAfterTime;
        _tickInterval = 1 / LogicFps;
        m_traps.AddRange(TrapManager.Init());
        InputManager.OnCellClick += OnCellClick;
        BeginDrag(false);
        ComputeSoul(8);
        _soulGainDuration = SoulGainBaseDuration;

        CharacterBehaviour.BubbleCount = 0;
    }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        ResetOnAwake();
    }
Beispiel #14
0
 void Awake()
 {
     if (_instance == null)
     {
         DontDestroyOnLoad(gameObject);
         _instance = this;
     }
     else
     {
         if (_instance != this)
         {
             Destroy(gameObject);
         }
     }
 }
Beispiel #15
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;

            Init();

            DontDestroyOnLoad(gameObject);
        }
        else
        {
            DestroyObject(gameObject);
        }
    }
Beispiel #16
0
    virtual protected void _ApplyCardInfo()
    {
        CardImage.sprite = GameSingleton.GetPlay().GetCardSprite(GetCardInfo());

        if (GetCardInfo().EnableSelectBtn == true)
        {
            SelectBtn.SetActive(true);
            GetCardImage().raycastTarget = false;
        }
        else
        {
            SelectBtn.SetActive(false);
            GetCardImage().raycastTarget = true;
        }
    }
Beispiel #17
0
    public void SetStep_PlayerUI(PlayTypes.SevenPokerStep step)
    {
        CurStep = step;
        switch (step)
        {
        case PlayTypes.SevenPokerStep.Begin:
        {
            CardSet.spacing = GameSingleton.GetPlay().GetBoard().ToSevenPoker().CardSpacing_Choice;
        }
        break;

        case PlayTypes.SevenPokerStep.ChoiceCardShare_Complete:
        {
            if (GetPlayer().ToSevenPoker().IsMyPlayer() == true)
            {
                gameObject.SetActive(false);
            }
        }
        break;

        case PlayTypes.SevenPokerStep.ChoiceCardSelect:
        {
            if (GetPlayer().ToSevenPoker().IsMyPlayer() == true)
            {
                gameObject.SetActive(true);

                CardUIList[0].SetCardView(PlayTypes.CardView.Dual);
                CardUIList[1].SetCardView(PlayTypes.CardView.Dual);
                CardUIList[2].SetCardView(PlayTypes.CardView.Dual);
            }

            CardSet.spacing = GameSingleton.GetPlay().GetBoard().ToSevenPoker().CardSpacing_Play;
        }
        break;

        case PlayTypes.SevenPokerStep.CardShare_4:
        {
            CardUIList[2].SetCardView(PlayTypes.CardView.Front);
        }
        break;
        }
    }
    // OpenCardIndex 는 ThrowCardIndex 버리고 나서의 인덱스 계산
    public void Recv_UserChoiceComplete(int PlayerIndex, int ThrowCardIndex, int OpenCardIndex)
    {
        SevenPokerPlayer player = GameSingleton.GetPlay().GetPlayer(PlayerIndex).ToSevenPoker();

        if (player.IsMyPlayer() == true)
        {
            // 버림 계산 후에
            player.RemoveCard_ByIndex(ThrowCardIndex);
            // 뒤로갈 카드 계산
            player.CardMoveToTail(OpenCardIndex);

            GameSingleton.GetPlay().GetBoard().ToSevenPoker().SetStep_Board(PlayTypes.SevenPokerStep.ChoiceCardSelect);
            player.SetStep_Player(PlayTypes.SevenPokerStep.ChoiceCardSelect);
        }
        else
        {
            player.RemoveCard_ByIndex(0);
            player.SetStep_Player(PlayTypes.SevenPokerStep.ChoiceCardSelect);
        }
    }
Beispiel #19
0
    // ===========================================================================
    //
    //  PlayerUI
    //
    // ===========================================================================
    public void LinkPlayerUI(int MyPositionIndex)
    {
        for (int i = 0; i < GameSingleton.GetPlay().GetMaxPlayer(); ++i)
        {
            PlayerBase player = GameSingleton.GetPlay().GetPlayer(i);

            // 내 위치는 0 으로 맞추고 상대적인 위치로 셋팅
            int RelativePositionIndex = i - MyPositionIndex;
            if (RelativePositionIndex < 0)
            {
                RelativePositionIndex += GameSingleton.GetPlay().GetMaxPlayer();
            }
            assert.set(RelativePositionIndex >= 0 && RelativePositionIndex < GameSingleton.GetPlay().GetMaxPlayer());

            SevenPokerPlayerUI ui = transform.Find(string.Format("User{0:00}", RelativePositionIndex + 1)).GetComponent <SevenPokerPlayerUI>();
            ui.gameObject.SetActive(false);

            assert.set(ui);
            player.SetPlayerUI(ui);
        }
    }
Beispiel #20
0
    virtual protected void Awake()
    {
        GameSingleton.SetPlay(this);

        // 보드 존재 하는지 체크
        assert.set(Board);

        // 카드팩 생성
        CardSpriteArray = Resources.LoadAll <Sprite>(CardPackPath);
        assert.set(CardSpriteArray.Length > 0);

        // 해당 플레이들을 맥스 플레이어 수만큼 미리 생성후 링크(원형)연결해둠
        PlayerBase first = null;
        PlayerBase last  = null;

        for (int i = 0; i < GetMaxPlayer(); ++i)
        {
            PlayerBase newPlayer = _CreatePlayer();
            PlayerList.Add(newPlayer);

            newPlayer.SetPlayerIndex(i);
            if (last != null)
            {
                last.SetNextPlayer(newPlayer);
                newPlayer.SetPrevPlayer(last);
            }
            if (i == 0)
            {
                first = newPlayer;
            }
            last = newPlayer;
        }
        assert.set(first != null);
        assert.set(last != null);
        assert.set(GetMaxPlayer() > 1);
        last.SetNextPlayer(first);
        first.SetPrevPlayer(last);
    }
Beispiel #21
0
 void OnDestroy()
 {
     GameSingleton.SetPlay(null);
 }
Beispiel #22
0
 public bool IsMyPlayer()
 {
     return(GameSingleton.GetPlay().ToSevenPoker().GetMyPlayer() == this);
 }
Beispiel #23
0
 void Awake()
 {
     instance = this;
 }
Beispiel #24
0
 virtual protected void Awake()
 {
     assert.set(CardSet);
     CardSet.cellSize = GameSingleton.GetPlay().CardSize;
 }