Example #1
0
 internal void SetRewards(ManorRegionComponent manorRegionComponent, List <CSWareHouseStruct> awardIds, SCUnlockArea regionUnLockDialogEndSucc)
 {
     this.manorRegionComponent = manorRegionComponent;
     this.awardIds             = awardIds;
     Root2dSceneManager._instance.awardIdsCurrManorRegion = awardIds;
     this.regionUnLockDialogEndSucc = regionUnLockDialogEndSucc;
     scrollReward.ClearCells();
     scrollReward.totalCount = awardIds.Count;
     scrollReward.RefillCells();
 }
Example #2
0
    private void SetRegionsUnLockInfoState()
    {
        ManorRegionComponent[] regionComs = GetAllManorRegionComponent();
        var allTileCom = transAllManorPlant.GetComponentsInChildren <TileComponent>();

        //设置all(0地块)的状态
        for (int i = 0; i < regionComs.Length; i++)
        {
            if (regionComs[i].regionId == 0)
            {
                regionComs[i].OnlySetAreaState(AreaState.RemoveWorkShed);
                break;
            }
        }
        //设置其它地块状态
        RepeatedField <SCUnlockAreaStruct> UnlockAreaInfo = null;

        if (Root2dSceneManager._instance.isFriendManor)
        {
            UnlockAreaInfo = Root2dSceneManager._instance.UnlockAreaInfoFriend;
        }
        else
        {
            UnlockAreaInfo = Root2dSceneManager._instance.UnlockAreaInfoSelf;
        }
        for (int i = 0; i < UnlockAreaInfo.Count; i++)
        {
            ManorRegionComponent currRegionCom = null;
            for (int j = 0; j < regionComs.Length; j++)
            {
                if (regionComs[j].regionId == UnlockAreaInfo[i].AreaId)
                {
                    currRegionCom = regionComs[j];
                    break;
                }
            }
            if (currRegionCom != null)
            {
                currRegionCom.SetManorRegionAreaState(UnlockAreaInfo[i].State, UnlockAreaInfo[i].AreaUnlockTime);
            }
        }
    }
Example #3
0
    public void SetRegionTimeChange(long timeStamp, ManorRegionComponent manorRegionComponent)
    {
        //计算当前服务器时间
        long CurrTimeStampServer = TimeHelper.ServerTimeStampNow;
        long CurrRemainTime      = timeStamp - CurrTimeStampServer;

        if (CurrRemainTime <= 0f)
        {
            manorRegionComponent.EndRoadWork();
            UIComponent.HideUI(UIType.UIManorRegionAdIncrease);
            Destroy(timeBoxTimerComponent.gameObject);
        }
        else
        {
            timeBoxTimerComponent.Init(CurrRemainTime / 1000f, false, (go) =>
            {
                manorRegionComponent.EndRoadWork();
                Destroy(timeBoxTimerComponent.gameObject);
            },
                                       (remainTime) =>
            {
                this.RemainTime = remainTime;
                if (goLock == null)
                {
                    return;
                }
                //设置倒计时时间
                goLock.SetActive(false);
                goUnLocking.SetActive(true);
                int h      = (int)(remainTime / 3600);
                remainTime = remainTime % 3600;
                int m      = (int)(remainTime / 60);
                remainTime = remainTime % 60;
                int s      = (int)remainTime;
                TextH.text = String.Format("{0:00}", h);
                TextM.text = String.Format("{0:00}", m);
                TextS.text = String.Format("{0:00}", s);
            });
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        UIManorComponent     uiManorComponent         = UIComponent.GetComponentHaveExist <UIManorComponent>(UIType.UIManor);
        UIWorldHandleManager uiUIWorldHandleComponent = StaticData.GetUIWorldHandleComponent();

        if (uiManorComponent == null)
        {
            return;                    //场景加载过程中
        }
        if (Input.GetMouseButtonUp(0)) //如果左键抬起重置
        {
            isTileDrag = false;
        }
        if (Input.GetMouseButtonDown(0))//左键按下
        {
            currHandleTile = null;
            bool isUIScrollMask   = false;
            bool isUIDecorateMask = false;
            //EventSystem.current.IsPointerOverGameObject()在android上unity2019不起作用
            var clickObj = StaticData.UI_GetCurrentSelect();
            if (clickObj != null)//表明是UI
            {
                isUIScrollMask   = clickObj.CompareTag(TagHelper.UIScrollMask);
                isUIDecorateMask = clickObj.CompareTag(TagHelper.DecorateUIMask);
            }
            if (Root2dSceneManager._instance.isTileDrag)
            {
                //地块正在拖拽的时候,相机不允许平移
                return;
            }
            //覆盖的不是UI
            if (clickObj == null || isUIScrollMask)
            {
                CloseAllTileObjSelect();
                if (uiUIWorldHandleComponent != null)
                {
                    uiUIWorldHandleComponent.SetHandleTileUIClose();
                }
                StaticData.DebugGreen("Not UI");
                Camera       cameraWorld = Root2dSceneManager._instance.worldCameraComponent.cameraWorld;
                var          worldPoint  = cameraWorld.ScreenToWorldPoint(Input.mousePosition);
                Collider2D[] colliders   = Physics2D.OverlapPointAll(worldPoint);
                //层级排序上边到下边

                /*
                 * TagHelper.CollierCanOver
                 * TagHelper.PlantRenderer//植物Render层,不能拖走的
                 * TagHelper.Tile
                 * TagHelper.Ground
                 */
                listOverlapPointCollider.Clear();
                //colliders 转list
                for (int i = 0; i < colliders.Length; i++)
                {
                    listOverlapPointCollider.Add(colliders[i]);
                }

                //add_by_wsf
                Collider2D colliderMouse = listOverlapPointCollider.Find(x => x.gameObject.CompareTag(TagHelper.MouseManor));
                if (colliderMouse != null)
                {
                    //点击地鼠
                    Debug.Log("敲打地鼠~~~");
                    mouseManorManager.CatchMouse();
                    return;
                }
                //add_by_wsf end

                Collider2D colliderTileCom = null;
                colliderTileCom = listOverlapPointCollider.Find(x => x.gameObject.CompareTag(TagHelper.CollierCanOver));
                if (colliderTileCom == null)
                {
                    colliderTileCom = listOverlapPointCollider.Find(x => x.gameObject.CompareTag(TagHelper.Tile));
                }

                var colliderGrounds = listOverlapPointCollider.FindAll(x => x.gameObject.CompareTag(TagHelper.Ground));
                if (colliderTileCom != null)
                {//点击树或者小地块
                    StaticData.DebugGreen($"{colliderTileCom.name}");

                    TileComponent tileCom = colliderTileCom.gameObject.GetComponent <TileComponent>();
                    //树需要到上一层才有组件,种植的作物要上三层
                    if (tileCom == null)
                    {
                        tileCom = colliderTileCom.transform.GetComponentInParent <TileComponent>();
                    }

                    if (tileCom != null)//别墅,仓库没有TileComponent
                    {
                        currHandleTile = tileCom.gameObject;
                        tileCom.PressInScene();
                    }
                }
                else if (colliderGrounds != null && colliderGrounds.Count > 0)
                {
                    //点击到大地块
                    //大地块点击,没解锁的地方的除了Ground其它地方碰撞器都是禁用的
                    var colliderGround = colliderGrounds.Find(x => x.gameObject.GetComponent <ManorRegionComponent>().regionId != 0);
                    if (colliderGround != null) //为null表示只有0的碰撞器
                    {                           //有限处理没解锁的
                        ManorRegionComponent manorRegion = colliderGround.gameObject.GetComponent <ManorRegionComponent>();
                        StaticData.DebugGreen($"大地块按下");
                        manorRegion.PressDownRegion();
                    }
                    else
                    {//用来处理人物点击空白的行走
                        StaticData.DebugGreen($"大地块0按下");
                        ManorRegionComponent manorRegion = colliderGrounds[0].gameObject.GetComponent <ManorRegionComponent>();
                        manorRegion.PressDownRegion();
                    }
                }
            }
            //如果点击到了装饰物的UI面板
            if (isUIDecorateMask)
            {
                ContineClickDecorate();
            }
        }
    }
Example #5
0
 public void BeginFirstAVGDialog()
 {
     this.manorRegionComponent = null;
     currDialogId = 12001;
     PlayDialog();
 }
Example #6
0
 internal void SetRegionComponent(ManorRegionComponent manorRegionComponent)
 {
     this.manorRegionComponent = manorRegionComponent;
     currDialogId = StaticData.configExcel.ManorRegionDialog.Find(x => x.regionId == manorRegionComponent.regionId).BeginDialogId;
     PlayDialog();
 }