Пример #1
0
    void MakeTextAreaAndButtonForSend()
    {
        if (isMyTurn)
        {
            pointString = GUI.TextField(new Rect(Screen.width / 2 - 40, Screen.height / 2 - 70, 100, 50), pointString);
            if (GUI.Button(new Rect(Screen.width / 2 - 40, Screen.height / 2, 100, 50), "보 내 기"))
            {
                try
                {
                    myPoint = int.Parse(pointString);
                }

                catch
                {
                    GameObject obj = GameObject.Find("Again");
                    obj      = Instantiate(editAgainPrefab);
                    obj.name = "Again";
                    obj.GetComponent <Transform>().position = new Vector3(-3, 5, 0);
                    waitTwoSecond = 2.0f;
                }

                if (myPoint > 99 || myPoint < 0 || myPointController.points - myPoint < 0)
                {
                    waitTwoSecond = 2.0f;
                    pointString   = "";
                    myPoint       = -1;
                    GameObject obj = GameObject.Find("Again");
                    if (obj == null)
                    {
                        obj      = Instantiate(editAgainPrefab);
                        obj.name = "Again";
                        obj.GetComponent <Transform>().position = new Vector3(-3, 5, 0);
                    }
                }
                else
                {
                    pointString = "";
                    networkController.SendPoints(myPoint);
                    myPointController.SetPoint(myPointController.points - myPoint);
                    myPointController.CheckPoint(my);
                    Debug.Log("sendpoint  " + myPoint);
                    Debug.Log(myPointController.getPoint() + " mypoint ");
                    isMyTurn = false;
                }
            }
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        width  = Screen.width;
        height = Screen.height;

        Debug.Log(width + "  " + height + "크기");

        gameState = GameState.None;



        nameList     = new ArrayList();
        gameInitList = new ArrayList();


        //Debug.Log("테스트  " + );
        font = new GUIStyle();

        oppPointController = oppPointsPrefab.GetComponent <RPointsController>();
        myPointController  = myPointsPrefab.GetComponent <RPointsController>();

        oppPointController.SetPoint(99);
        myPointController.SetPoint(99);

        GameObject go = new GameObject("Network");

        if (go != null)
        {
            TCP transport = go.AddComponent <TCP>();
            if (transport != null)
            {
                transport.RegisterEventHandler(EventCallback);
            }
        }

        DontDestroyOnLoad(go);
        string hostname = Dns.GetHostName();

        IPAddress[] adrList = Dns.GetHostAddresses(hostname);
        ipAddr = adrList[0].ToString();
    }
Пример #3
0
    void WaitingSignOppPointAndCreateOppResultForFirstAttacker()
    {
        if (oppPoint == -1 && isFirst)
        {
            GameObject obj = GameObject.Find("Waiting");
            if (obj == null)
            {
                obj = Instantiate(waitingSignPrefab);
                obj.GetComponent <Transform>().position = new Vector3(-2.5f, 5, 0);
                obj.name = "Waiting";
                gameInitList.Add(obj.name);
            }
        }
        else if (oppPoint != -1 && isFirst)
        {
            if (isReceivePoint == false)
            {
                isReceivePoint = true;
                Debug.Log("comming   " + oppPoint);
                oppPointController.SetPoint(oppPointController.points - oppPoint);

                oppPointController.CheckPoint(opp);
            }

            try
            {
                GameObject obj = GameObject.Find("Waiting");
                Destroy(obj);
            }
            catch
            {
            }


            if (oppPoint < 10)
            {
                GameObject obj = GameObject.Find("oppBlack");
                if (obj == null)
                {
                    obj = Instantiate(blackForPointResultPrefab);
                    obj.GetComponent <Transform>().position = new Vector3(-4, 1, 0);
                    obj.name     = "oppBlack";
                    isShowResult = true;
                    gameInitList.Add(obj.name);
                }
            }

            else
            {
                GameObject obj = GameObject.Find("oppWhite");
                if (obj == null)
                {
                    obj = Instantiate(whiteForPointResultPrefab);
                    obj.GetComponent <Transform>().position = new Vector3(-4, 1, 0);
                    obj.name = "oppWhite";
                    gameInitList.Add(obj.name);
                    isShowResult = true;
                }
            }
        }
    }
Пример #4
0
	// Use this for initialization
	void Start () {
        width = Screen.width;
        height = Screen.height;

        Debug.Log(width + "  " + height + "크기");

        gameState = GameState.None;

      
        

        nameList = new ArrayList();
        gameInitList = new ArrayList();
       
     
        //Debug.Log("테스트  " + );
        font = new GUIStyle();

        oppPointController = oppPointsPrefab.GetComponent<RPointsController>();
        myPointController = myPointsPrefab.GetComponent<RPointsController>();

        oppPointController.SetPoint(99);
        myPointController.SetPoint(99);

        GameObject go = new GameObject("Network");
        if(go!=null)
        {
            TCP transport = go.AddComponent<TCP>();
            if (transport != null)
                transport.RegisterEventHandler(EventCallback);

        }

        DontDestroyOnLoad(go);
        string hostname = Dns.GetHostName();
        IPAddress[] adrList = Dns.GetHostAddresses(hostname);
        ipAddr = adrList[0].ToString();
	}