示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Misc.GetBack())
        {
            gameObject.SetActive(false);

            strCtrl.ReturnMainMode();
        }
    }
    void OnReturnMainMode()
    {
        timeTick += Time.deltaTime;
        if (timeTick >= 0.2f)
        {
            timeTick = 0;

            gameObject.SetActive(false);
            strCtrl.ReturnMainMode();
        }
    }
示例#3
0
    void OnChangingToCommandModeHandler()
    {
        timeTick += Time.deltaTime;
        if (timeTick >= 0.2f)
        {
            timeTick = 0;
            state    = 0;

            gameObject.SetActive(false);

            switch (commandIdx)
            {
            case -1:
                strCtrl.ReturnMainMode();
                break;

            case 0:
                generalsInfo.AddArmyGeneralsList(armyInfo);
                break;

            case 1:
                selectTargetCity.SetArmy(armyInfo);
                break;

            case 2:
                armyInfo.armyCtrl.SetArmyGarrison();
                strCtrl.ReturnMainMode();
                break;

            case 3:
                generalsInfo.AddArmyPrisonsList(armyInfo);
                break;

            case 4:
                OnIntoCity();
                break;
            }
        }
    }
示例#4
0
    void OnReturnMainModeHandler()
    {
        timeTick += Time.deltaTime;

        if (timeTick >= 0.2f)
        {
            timeTick = 0;

            gameObject.SetActive(false);

            //StrategyController.state = StrategyController.State.Normal;
            strCtrl.ReturnMainMode();
        }
    }
示例#5
0
    void OnReturnMain()
    {
        timeTick += Time.deltaTime;
        if (timeTick < 0.2f)
        {
            return;
        }

        state    = 0;
        timeTick = 0;

        gameObject.SetActive(false);
        map.gameObject.SetActive(false);

        strCtrl.ReturnMainMode();
    }
    void OnChangingToCommandModeHandler()
    {
        timeTick += Time.deltaTime;
        if (timeTick >= 0.2f)
        {
            timeTick = 0;

            gameObject.SetActive(false);

            switch (commandIdx)
            {
            case -1:
                strCtrl.ReturnMainMode();
                break;

            case 0:
                expedition.SetCity(cityIdx);
                break;

            case 1:
                conscription.SetCity(cityIdx);
                break;

            case 2:
                generalsInfo.AddGeneralsList(cityIdx);
                break;

            case 3:
                generalsInfo.AddPrisonsList(cityIdx);
                break;

            case 4:
                prefectAppointed.AddGeneralsList(cityIdx);
                break;
            }
        }
    }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        if (!isQuitConfirmMode)
        {
            if (Misc.GetBack())
            {
                gameObject.SetActive(false);
                strCtrl.ReturnMainMode();
                return;
            }

            if (Input.GetMouseButtonUp(0))
            {
                Vector3 mousePoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                Vector2 point      = new Vector2(mousePoint.x, mousePoint.y);

                Rect bound = bgSprite.boundingRect;
                bound.x += transform.position.x;
                bound.y += transform.position.y;

                if (!bound.Contains(point))
                {
                    gameObject.SetActive(false);
                    Input.ResetInputAxes();
                    strCtrl.ReturnMainMode();
                    return;
                }
            }

            for (int i = 0; i < 4; i++)
            {
                if (commands[i].GetButtonState() == Button.ButtonState.Clicked)
                {
                    if (i == 3)
                    {
                        isQuitConfirmMode = true;

                        confirmBox.SetActive(true);

                        Vector3 pos = commands[i].transform.position;
                        if (pos.x + 100 + 128 < 320)
                        {
                            confirmBox.transform.position = new Vector3(pos.x + 100 + 64, pos.y + 10, confirmBox.transform.position.z);
                        }
                        else
                        {
                            confirmBox.transform.position = new Vector3(pos.x - 100 - 64, pos.y + 10, confirmBox.transform.position.z);
                        }
                    }
                    else
                    {
                        commandAct[i].SetActive(true);
                        gameObject.SetActive(false);
                    }
                }
            }
        }
        else
        {
            if (Misc.GetBack())
            {
                isQuitConfirmMode = false;
                confirmBox.SetActive(false);
                return;
            }

            if (okBtn.GetButtonState() == Button.ButtonState.Clicked)
            {
                Controller.historyTime = 190;
                HistoryTimeController.Reset();
                StrategyController.Reset();
                Informations.Instance.armys.Clear();

                Application.LoadLevel(0);
                GameObject.Destroy(GameObject.Find("MouseTrack"));
            }
            else if (cancelBtn.GetButtonState() == Button.ButtonState.Clicked)
            {
                isQuitConfirmMode = false;
                confirmBox.SetActive(false);
            }
        }
    }
示例#8
0
    // Update is called once per frame
    void Update()
    {
        if (Misc.GetBack())
        {
            gameObject.SetActive(false);
            strCtrl.ReturnMainMode();
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            isMouseMove  = false;
            mouseDownPos = Input.mousePosition;
        }
        else if (!isMouseMove && Input.GetMouseButtonUp(0))
        {
            int targetCity = flagsCtrl.GetTouchCityIdx();
            if (targetCity != -1)
            {
                armyInfo.armyCtrl.SetRoute(path.GetRoute(armyInfo.armyCtrl.transform.position, targetCity));
                armyInfo.armyCtrl.SetArmyRunning();
                if (targetCity == armyInfo.cityFrom)
                {
                    armyInfo.cityFrom = armyInfo.cityTo;
                }
                armyInfo.cityTo = targetCity;

                gameObject.SetActive(false);
                strCtrl.ReturnMainMode();

                Input.ResetInputAxes();
            }
        }
        else if (Input.GetMouseButton(0))
        {
            if (!isMouseMove)
            {
                Vector3 offset = mouseDownPos - Input.mousePosition;
                offset.Scale(scale);

                if (Mathf.Abs(offset.x) > 5 || Mathf.Abs(offset.y) > 5)
                {
                    isMouseMove  = true;
                    mouseDownPos = Input.mousePosition;

                    /*
                     * Vector3 pos = Camera.main.transform.position;
                     *
                     * pos += offset;
                     * pos.x = Mathf.Clamp(pos.x, -320, 320);
                     * pos.y = Mathf.Clamp(pos.y, -240, 240);
                     *
                     * Camera.main.transform.position = pos;
                     */
                }
            }
            else
            {
                Vector3 offset = mouseDownPos - Input.mousePosition;
                mouseDownPos = Input.mousePosition;
                offset.Scale(scale);

                Vector3 pos = Camera.main.transform.position;

                pos  += offset;
                pos.x = Mathf.Clamp(pos.x, -320, 320);
                pos.y = Mathf.Clamp(pos.y, -240, 240);

                Camera.main.transform.position = pos;
            }
        }
    }