Пример #1
0
    public void OnClickBuyButton(int pType)
    {
        Sound.Instans.PlaySe(Sound.Instans.pushSound);
        onePArrow.SetActive(false);
        twoPArrow.SetActive(false);
        p1Button.SetActive(false);
        p2Button.SetActive(false);
        p1BuyButton.SetActive(false);
        p2BuyButton.SetActive(false);
        //確認ダイアログ buyChara
        buyPanelContainer.SetActive(true);
        buyPanel.SetActive(true);
        if (pType == 1)
        {
            buyChara = buyChara1;
        }
        else
        {
            buyChara = buyChara2;
        }
        buySelectChara = Instantiate(buyChara) as GameObject;
        buySelectChara.transform.SetParent(backPanel.transform);
        buySelectChara.transform.localPosition = new Vector3(0f, -0.91f, -1.21f);
        buySelectChara.transform.localRotation = Quaternion.Euler(new Vector3(0f, 180f, 0f));
        buySelectChara.transform.localScale    = new Vector3(1f, 1f, 1f);

        SelectPlayer sp   = buyChara.GetComponent <SelectPlayer> ();
        string       text = string.Format("コイン{0:D}まいでかいますか?", sp.price);

        buyText.GetComponent <TextMeshProUGUI> ().text = text;
    }
Пример #2
0
        public Dictionary <Attributes, int> GetPlayerParams(SelectPlayer selectPlayer = SelectPlayer.None)
        {
            if (selectPlayer == SelectPlayer.None)
            {
                selectPlayer = (SelectPlayer)currentPlayer;
            }

            int i = (int)selectPlayer;

            if (players[i] != null)
            {
                log.Info("GetPlayerParams type: " + players[i].type);
                return(players[i].PlayerParams);
            }


            Dictionary <Attributes, int> DefaultParams = new Dictionary <Attributes, int>();

            DefaultParams = new Dictionary <Attributes, int>();
            DefaultParams.Add(Attributes.Wall, 5);
            DefaultParams.Add(Attributes.Tower, 10);

            DefaultParams.Add(Attributes.Menagerie, 1);
            DefaultParams.Add(Attributes.Colliery, 1);
            DefaultParams.Add(Attributes.DiamondMines, 1);

            DefaultParams.Add(Attributes.Rocks, 5);
            DefaultParams.Add(Attributes.Diamonds, 5);
            DefaultParams.Add(Attributes.Animals, 5);

            return(DefaultParams);
        }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     m_rect         = GetComponent <RectTransform>();
     m_option       = GameObject.FindObjectOfType <Option>();
     m_selectPlayer = GameObject.Find("SelectPlayer").GetComponent <SelectPlayer>();
     SoundManager.Instance.PlayBGMByName("Select");
 }
Пример #4
0
    public void setupSelectPlayerPanel(Player player, int playerNumber)
    {
        playerSprite.sprite = Resources.Load <Sprite>(player.sprite);
        nameText.text       = player.characterName;
        levelText.text      = "LV " + player.level;
        hpText.text         = "HP: " + player.maxHp;

        panel.GetComponent <Button>().onClick.AddListener(delegate { SelectPlayer.selectPlayer(playerNumber); });
    }
Пример #5
0
        /// <summary>
        /// Initializes the dictionary object.
        /// </summary>
        /// <returns>Commands dictionary.</returns>
        private static Dictionary <string, IGameCommand> InitializeList()
        {
            Dictionary <string, IGameCommand> list = new Dictionary <string, IGameCommand>();

            IGameCommand loginCommand = new Login();

            list.Add(loginCommand.Name, loginCommand);

            IGameCommand getPlayerCommand = new GetPlayersList();

            list.Add(getPlayerCommand.Name, getPlayerCommand);

            IGameCommand selectPlayerCommand = new SelectPlayer();

            list.Add(selectPlayerCommand.Name, selectPlayerCommand);

            IGameCommand uiLoadCompleteCommand = new UILoadComplete();

            list.Add(uiLoadCompleteCommand.Name, uiLoadCompleteCommand);

            IGameCommand updateScoreCommand = new UpdateScore();

            list.Add(updateScoreCommand.Name, updateScoreCommand);

            IGameCommand gameCompleteCommand = new GameComplete();

            list.Add(gameCompleteCommand.Name, gameCompleteCommand);

            IGameCommand sendJigSawCoordinates = new SendJigSawCoordinates();

            list.Add(sendJigSawCoordinates.Name, sendJigSawCoordinates);

            IGameCommand selectTile = new SelectTile();

            list.Add(selectTile.Name, selectTile);

            IGameCommand disableTile = new DisableTile();

            list.Add(disableTile.Name, disableTile);

            IGameCommand assignTile = new AssignTile();

            list.Add(assignTile.Name, assignTile);

            IGameCommand resetTile = new ResetTile();

            list.Add(resetTile.Name, resetTile);

            return(list);
        }
Пример #6
0
    public void ShowPanel(PanelType panelType)
    {
        switch (panelType)
        {
        case PanelType.MainMenu:
            if (MainPanel != null)
            {
                MainPanel.gameObject.SetActive(true);
                EventSystem.current.SetSelectedGameObject(playButton, new BaseEventData(EventSystem.current));
            }
            break;

        case PanelType.Options:
            if (OptionsPanel != null)
            {
                OptionsPanel.gameObject.SetActive(true);
            }
            break;

        case PanelType.Pause:
            if (PausePanel != null && SceneManager.GetActiveScene().name == "GameScene")
            {
                PausePanel.gameObject.SetActive(true);
                EventSystem.current.SetSelectedGameObject(continueButton, new BaseEventData(EventSystem.current));
                Time.timeScale = 0f;
            }
            break;

        case PanelType.PlayerSelection:
            if (PlayerSelectionPanel != null)
            {
                PlayerSelectionPanel.gameObject.SetActive(true);
                playerSelectionScript = PlayerSelectionPanel.GetComponent <SelectPlayer> ();
            }
            break;

        case PanelType.HudPanel:
            if (HudPanel != null)
            {
                HudPanel.gameObject.SetActive(true);
                Debug.Log(playerSelectionScript.joinedPlayers);
                hudController.createHUD(playerSelectionScript.joinedPlayers, 100);
            }
            break;

        default:
            break;
        }
    }
Пример #7
0
        public List <Card> GetPlayersCard(SelectPlayer selectPlayer = SelectPlayer.None)
        {
            if (selectPlayer == SelectPlayer.None)
            {
                selectPlayer = (SelectPlayer)currentPlayer;
            }

            int i = (int)selectPlayer;

            if (players[i] != null)
            {
                log.Info("GetPlayerParams type: " + players[i].type);
                return(players[i].Cards);
            }

            return(new List <Card>());
        }
Пример #8
0
    private void Awake() // csv, xml 로드
    {
        selectPlayer = GetComponent <SelectPlayer>();

        /* 오브젝트 아이템 리스트 로드 */
        itemList     = CSVReader.Read("Data/itemList");
        recipeList   = CSVReader.Read("Data/RecipeList");
        huntableList = CSVReader.Read("Data/huntableTable");

        items = new List <Item>();

        for (int i = 0; i < itemList.Count; i++)
        {
            Item item = new Item();
            item.name   = itemList[i]["name"].ToString();
            item.ID     = itemList[i]["ID"].ToString();
            item.effect = itemList[i]["effect"].ToString();
            item.tool   = itemList[i]["tool"].ToString();
            item.sprite = findSprite(item.ID);

            switch (itemList[i]["type"].ToString())
            {
            case "food":
                item.type = Item.ItemType.food;
                break;

            case "material":
                item.type = Item.ItemType.material;
                break;

            case "memo":
                item.type = Item.ItemType.memo;
                break;

            case "tool":
                item.type = Item.ItemType.tool;
                break;
            }

            items.Add(item);
        }
        /* 오브젝트 아이템 리스트 로드 끝 */
    }
Пример #9
0
    public void OnClickBuyFixButton()
    {
        Sound.Instans.PlaySe(Sound.Instans.fixSound);
        buyPanel.SetActive(false);
        //コイン減らす playerPrefsに追加
        SelectPlayer sp          = buyChara.GetComponent <SelectPlayer> ();
        int          currentCoin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
        int          afterCoin   = currentCoin - sp.price;

        EncryptedPlayerPrefs.SaveInt(Const.KEY_COIN, afterCoin);
        int charaNo = sp.charaType + sp.charaSeq;

        AddEnableCharas(charaNo);
        coinText.GetComponent <TextMeshProUGUI>().text = afterCoin.ToString();

        Animator animator = buySelectChara.GetComponent <Animator> ();

        animator.enabled = true;
        if (sp.charaType == PlayerInfo.KOHAKU)
        {
            animator.SetBool("Win1", true);
        }
        else if (sp.charaType == PlayerInfo.YUKO)
        {
            animator.SetBool("Win2", true);
        }
        else if (sp.charaType == PlayerInfo.MISAKI)
        {
            animator.SetBool("Win3", true);
        }

        DOVirtual.DelayedCall(4f, () => {
            //UIを再構築
            EnableChara(ref kohaku1Array);
            EnableChara(ref yuko1Array);
            EnableChara(ref misaki1Array);
            EnableChara(ref kohaku2Array);
            EnableChara(ref yuko2Array);
            EnableChara(ref misaki2Array);
            CloseBuyPanel();
        });
    }
Пример #10
0
 protected void SetPos(SelectPlayer e)
 {
     if (player == null)
     {
         player = e.player;
     }
     else
     {
         if (_blocked)
         {
             if (player.playerType != e.player.playerType)
             {
                 PlayerToPlayer(e.player.gameObject);
                 player = e.player;
             }
         }
         else
         {
             PlayerToPlayer(e.player.gameObject);
             player = e.player;
         }
     }
 }
Пример #11
0
    // Update is called once per frame
    void Update()
    {
        // nameDisplay.text = objectName
        cameraMovement = CameraController.GetComponent <CameraMovement>();
        cursorMovement = PointerMove.GetComponent <CursorMovement>();
        isHover        = cursorMovement.getIsOverPlayer();

        selectPlayer = Pointer.GetComponent <SelectPlayer>();
        isSelected   = selectPlayer.getIsSelected();

        if (isSelected)
        {
            PlayerUnit    = selectPlayer.GetSelectedObject();
            playerControl = PlayerUnit.GetComponent <PlayerController>();
            isMoving      = playerControl.getIsMoving();
        }

        showUnitInfo(isSelected, isHover);
        showUnitCommand(isSelected, isMoving);
        if (isSelected && !isMoving)
        {
            unitCommand();
        }
    }
Пример #12
0
    // Update is called once per frame
    void Update()
    {
        if (objectSelected)
        {
            if (playerControl.getIsMoving())
            {
                CursorMovement cursorMovement = PointerMove.GetComponent <CursorMovement>();
                if (!cursorMovement.getIsOverPlayer())
                {
                    if (Input.GetKeyDown(KeyCode.Space))
                    {
                        destination = Pointer.transform.position - new Vector3(0, 2.95001f, 0);
                        float m = Mathf.Abs(destination.x - transform.position.x), n = Mathf.Abs(destination.z - transform.position.z);
                        switch ((int)(m + n) <= 3)
                        {
                        case true:
                            transform.position = destination;
                            objectSelected     = false;
                            SelectPlayer sp = Pointer.GetComponent <SelectPlayer>();
                            sp.setIsSelected(false);
                            playerControl.setIsMoving(false);
                            break;

                        case false:
                            showUnitWarning();
                            break;
                        }
                    }
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            UnitWarning();
        }
    }
Пример #13
0
 private void Start()
 {
     playerManager = SelectPlayer.instance;
     myStats       = GetComponent <CharatersStats>();
 }
Пример #14
0
 void Awake()
 {
     instance = this;
     //player = GameObject.FindGameObjectWithTag("Player");
 }
Пример #15
0
    public void GeneratePathTo(int x, int y)
    {
        SelectPlayer sp     = Pointer.GetComponent <SelectPlayer>();
        GameObject   player = sp.GetSelectedObject();

        player.GetComponent <PlayerMovement>().currentPath = null;

        Dictionary <Node, float> distance = new Dictionary <Node, float>();
        Dictionary <Node, Node>  prev     = new Dictionary <Node, Node>();

        List <Node> unvisited = new List <Node>();

        Node source = graph[
            (int)(player.transform.position.x + 4.5f),
            (int)(player.transform.position.z + 4.5f)];

        Node target = graph[
            x,
            y];

        distance[source] = 0;
        prev[source]     = null;

        foreach (Node vertex in graph)
        {
            if (vertex != source)
            {
                distance[vertex] = Mathf.Infinity;
                prev[vertex]     = null;
            }

            unvisited.Add(vertex);
        }

        while (unvisited.Count > 0)
        {
            Node u = null;

            foreach (Node possibleU in unvisited)
            {
                if (u == null || distance[possibleU] < distance[u])
                {
                    u = possibleU;
                }
            }

            if (u == target)
            {
                break;
            }

            unvisited.Remove(u);

            foreach (Node v in u.edges)
            {
                float alt = distance[u] + 1;
                if (alt < distance[v])
                {
                    distance[v] = alt;
                    prev[v]     = u;
                }
            }
        }

        if (prev[target] == null)
        {
            return;
        }

        currentPath = new List <Node>();
        Node curr = target;

        while (curr != null)
        {
            currentPath.Add(curr);
            curr = prev[curr];
        }

        currentPath.Reverse();

        player.GetComponent <PlayerMovement>().currentPath = currentPath;
    }
Пример #16
0
 public void OnSetPlayer(SelectPlayer e)
 {
     _player     = e.player;
     _playerType = e.player.playerType;
 }
Пример #17
0
    //決定ボタン制御
    private void SetBuyButton(PlayerInfo.PlayerType player, GameObject charaObj)
    {
        if (PlayerInfo.PlayerType.Player1 == player)
        {
            buyChara1 = charaObj;
        }
        else
        {
            buyChara2 = charaObj;
        }

        SelectPlayer selectChara = charaObj.GetComponent <SelectPlayer> ();

        if (selectChara.enableFlg)
        {
            // 使える
            if (player == PlayerInfo.PlayerType.Player1)
            {
                p1Button.SetActive(true);
                p1BuyButton.SetActive(false);
            }
            else
            {
                p2Button.SetActive(true);
                p2BuyButton.SetActive(false);
            }
        }
        else
        {
            float alpha = 0.3f;
            //ボタンに値段をセット
            int             price = selectChara.price;
            TextMeshProUGUI priceText;
            Image           buttonImage;
            if (player == PlayerInfo.PlayerType.Player1)
            {
                p1Button.SetActive(false);
                p1BuyButton.SetActive(true);
                buttonImage    = p1BuyButton.GetComponent <Image> ();
                priceText      = p1PriceText.GetComponent <TextMeshProUGUI> ();
                priceText.text = price.ToString();
            }
            else
            {
                p2Button.SetActive(false);
                p2BuyButton.SetActive(true);
                buttonImage    = p2BuyButton.GetComponent <Image> ();
                priceText      = p2PriceText.GetComponent <TextMeshProUGUI> ();
                priceText.text = price.ToString();
            }
            int coin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
            if (coin >= price)
            {
                // 買える
                if (player == PlayerInfo.PlayerType.Player1)
                {
                    p1BuyButton.GetComponent <Button> ().enabled = true;
                }
                else
                {
                    p2BuyButton.GetComponent <Button> ().enabled = true;
                }
                DOTween.ToAlpha(() => buttonImage.color, color => buttonImage.color = color, 1f, 0f);
                DOTween.ToAlpha(() => priceText.color, color => priceText.color     = color, 1f, 0f);
            }
            else
            {
                // 買えない
                if (player == PlayerInfo.PlayerType.Player1)
                {
                    p1BuyButton.GetComponent <Button> ().enabled = false;
                }
                else
                {
                    p2BuyButton.GetComponent <Button> ().enabled = false;
                }
                DOTween.ToAlpha(() => buttonImage.color, color => buttonImage.color = color, alpha, 0f);
                DOTween.ToAlpha(() => priceText.color, color => priceText.color     = color, alpha, 0f);
            }
        }
    }
Пример #18
0
    private void AddPlayer(int playerNum)
    {
        startButton.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Images/PressStart");

        numPlayers          += 1;
        globalObj.numPlayers = numPlayers;

        switch (numPlayers)
        {
        case 1:
            globalObj.p1JoyMap = "_p" + playerNum;
            break;

        case 2:
            globalObj.p2JoyMap = "_p" + playerNum;
            break;

        case 3:
            globalObj.p3JoyMap = "_p" + playerNum;
            break;

        case 4:
            globalObj.p4JoyMap = "_p" + playerNum;
            break;
        }

        switch (numPlayers)
        {
        case 1:
            q1.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("None");
            SelectPlayer playerObj1 = ((GameObject)Instantiate(playerRes, q1.transform.position, Quaternion.identity)).GetComponent <SelectPlayer> ();
            playerObj1.numPlayer            = numPlayers - 1;
            playerObj1.transform.localScale = new Vector2(2, 2);
            //q1.GetComponent<Animator> ().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController> ("Images/Kiwi/KiwiDanceController");
            break;

        case 2:
            q2.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("None");
            SelectPlayer playerObj2 = ((GameObject)Instantiate(playerRes, q2.transform.position, Quaternion.identity)).GetComponent <SelectPlayer> ();
            playerObj2.numPlayer            = numPlayers - 1;
            playerObj2.transform.localScale = new Vector2(2, 2);
            //q2.GetComponent<Animator> ().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController> ("Images/Kiwi/KiwiDanceController");
            break;

        case 3:
            q3.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("None");
            SelectPlayer playerObj3 = ((GameObject)Instantiate(playerRes, q3.transform.position, Quaternion.identity)).GetComponent <SelectPlayer> ();
            playerObj3.numPlayer            = numPlayers - 1;
            playerObj3.transform.localScale = new Vector2(2, 2);
            //q3.GetComponent<Animator> ().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController> ("Images/Kiwi/KiwiDanceController");
            break;

        case 4:
            q4.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("None");
            SelectPlayer playerObj4 = ((GameObject)Instantiate(playerRes, q4.transform.position, Quaternion.identity)).GetComponent <SelectPlayer> ();
            playerObj4.numPlayer            = numPlayers - 1;
            playerObj4.transform.localScale = new Vector2(2, 2);
            //q4.GetComponent<Animator> ().runtimeAnimatorController = Resources.Load <RuntimeAnimatorController> ("Images/Kiwi/KiwiDanceController");
            break;
        }
    }
Пример #19
0
 protected void OnSelectPlayer(SelectPlayer e)
 {
     Events.Instance.RemoveListener <SelectPlayer>(OnSelectPlayer);
     ValidStep();
 }