示例#1
0
    private void BuildingSelected(object obj)
    {
        int num = (int)obj;

        curSlot = num;
        if (num == -1)
        {
            if (selectType != null)
            {
                selectType(null);
            }
            return;
        }

        CityMediator cityMediator = GameFacade.GetMediator <CityMediator> ();
        BuildingData data         = cityMediator.GetDataBySlot(curSlot);

        if (data != null)
        {
            if (selectType != null)
            {
                selectType(typeDic[data.type]);
            }
        }
        else
        {
                        #if UNITY_EDITOR
            Game.StartCoroutine(AAA());
                        #endif
        }
    }
示例#2
0
    private void BuildingBtnClick(object name)
    {
        string n = name.ToString();

        CityMediator cityMediator = GameFacade.GetMediator <CityMediator> ();

        switch (n)
        {
        case "details":
            EventManager.GetInstance().SendEvent("Private_HideBuildingButtons");
            UIManager.GetInstance().OpenUI("CityInfoUI");
            break;

        case "levelUp":
            int s = cityMediator.curSlot;
            SendBuildingLevelUp(cityMediator.GetDataBySlot(s).guid);
            break;

        case "training":
            UIManager.GetInstance().OpenUI("TroopTrainUI");
            break;

        case "collect":

            break;

        case "research":
            UIManager.GetInstance().OpenUI("ResearchUI");
            break;
        }
    }
    public void ShowCurSlotCenter()
    {
        if (curSlot != null)
        {
            curSlot.ShowBuildingName();

            BuildingData data = mediator.GetDataBySlot(mediator.curSlot);
            curSlot.level = data.level;

            curSlot.ShowBuildingLevel();
            Vector3 offset = curSlot.cameraOffset;
            Vector3 pos    = new Vector3(curSlot.transform.position.x + offset.x, cameraMove.limitBounds.center.y + cameraMove.limitBounds.extents.y + offset.y, curSlot.transform.position.z - Mathf.Tan(cameraMove.angleXRange.y) * (cameraMove.limitBounds.center.y + cameraMove.limitBounds.extents.y) + offset.z);
            Vector3 angle  = new Vector3(cameraMove.angleXRange.y, 0f, 0f);


            cameraMove.transform.DOMove(pos, 0.5f).SetEase(Ease.OutCirc);
            cameraMove.cam.transform.DORotate(angle, 0.5f).SetEase(Ease.OutCirc);

            targetHighlight = curSlot.modelChild.GetComponent <HighlighterController> ();
            targetHighlight.Fire2();
            ShowBtns();
        }
    }