Exemplo n.º 1
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);
            }
        }
    }