/// <summary>
    /// 打开区域
    /// </summary>
    /// <param name="onComplete"></param>
    public override void OpenDep(Action onComplete = null, bool isFocusT = true)
    {
        HideFacotry();
        BuildingController building = ParentNode.ParentNode as BuildingController;

        if (building != null)
        {
            building.LoadRoom(ParentNode, true, floor =>
            {
                OnDevCreateComplete = onComplete;
                //DepNode lastDep = FactoryDepManager.currentDep;
                //FactoryDepManager.currentDep = this;
                //SceneEvents.OnDepNodeChanged(lastDep, this);

                SceneEvents.OnDepNodeChanged(this);
                //Todo:摄像头聚焦
                if (isFocusT)
                {
                    FocusOn(() =>
                    {
                        AfterRoomFocus(true);
                    });
                }
                else
                {
                    AfterRoomFocus(true);
                }
            });
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 打开区域
    /// </summary>
    /// <param name="onComplete"></param>
    public override void OpenDep(Action onComplete = null, bool isFocusT = true)
    {
        ShowFactory();
        DisSelectLastDep();
        if (isFocusT)
        {
            IsFocus = true;
            FocusOn(onComplete);
        }
        else
        {
            if (onComplete != null)
            {
                onComplete();
            }
        }
        foreach (var building in ChildNodes)
        {
            building.HighlightOn(false);
        }
        //DepNode lastDep = FactoryDepManager.currentDep;
        //FactoryDepManager.currentDep = this;
        //SceneEvents.OnDepNodeChanged(lastDep, FactoryDepManager.currentDep);

        SceneEvents.OnDepNodeChanged(this);
    }
Exemplo n.º 3
0
 private void CreateUserSkeleton(Transform thisUserSkeleton, long id)
 {
     if (SceneEvents.SkeletonUserCreate != null)
     {
         SceneEvents.SkeletonUserCreate(thisUserSkeleton, id);
     }
 }
Exemplo n.º 4
0
        public static void Lose()
        {
            AudioController.PlayLose();

            SceneEvents.ChangeScene("_Lose");

            Instance.GameOver();
        }
Exemplo n.º 5
0
        public static void Win()
        {
            AudioController.PlayWin();

            SceneEvents.ChangeScene("_Win");

            Instance.GameOver();
        }
    public static void SetCurrentDepNode(DepNode node)
    {
        //DepNode last = currentDep;
        //currentDep = node;
        //SceneEvents.OnDepNodeChanged(last, currentDep);

        SceneEvents.OnDepNodeChanged(node);
    }
Exemplo n.º 7
0
 /// <summary>
 /// 返回园区
 /// </summary>
 private void BackToFactory()
 {
     IsFocus = false;
     HideDep();
     CameraSceneManager.Instance.ReturnToDefaultAlign();
     FactoryDepManager.currentDep = FactoryDepManager.Instance;
     SceneEvents.OnDepNodeChanged(this, FactoryDepManager.currentDep);
     SceneBackButton.Instance.Hide();
 }
    /// <summary>
    /// 加载机房
    /// </summary>
    /// <param name="depNode"></param>
    /// <param name="isFocusRoom"></param>
    /// <param name="OnComplete"></param>
    private void RoomCreate(DepNode depNode, bool isFocusRoom, Action <FloorController> OnComplete = null)
    {
        int roomId = depNode.NodeID;

        Log.Info(string.Format("RoomCreate2 DepNode:{0},{1}", depNode, depNode.TopoNode != null));
        GameObject roomObject = GetRoomObject(roomId);

        FloorController controller = roomObject.GetComponent <FloorController>();

        controller.RecordPosInBuilding(depNode);  //记录在大楼中的位置信息
        controller.SetColliderState(false);

        DisplayFloor(controller);//单独展示楼层

        controller.ShowFloorDev();
        if (controller.TopoNode == null)
        {
            controller.SetTopoNode(depNode.TopoNode);                               //设置TopoNode
        }
        currentRoom = controller;
        if (!isFocusRoom)
        {
            SceneEvents.OnDepNodeChanged(currentRoom);
            if (!LocationManager.Instance.IsFocus)
            {
                //摄像头对焦完成后,开始加载设备
                FocusCamera(roomObject, () =>
                {
                    controller.CreateFloorDev(() =>
                    {
                        if (OnComplete != null)
                        {
                            OnComplete(currentRoom);
                        }
                    });
                });
            }
            else
            {
                controller.CreateFloorDev(() =>
                {
                    if (OnComplete != null)
                    {
                        OnComplete(currentRoom);
                    }
                });
            }
        }
        else
        {
            if (OnComplete != null)
            {
                OnComplete(currentRoom);
            }
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// 切换至锅炉区
 /// </summary>
 private void SwitchToBoilerRoom(bool value)
 {
     ToggleTextAlphaChange(fullViewUI.boilerRoomToggle, value);
     if (value)
     {
         isFullView  = true;
         currentPart = FullViewPart.BoilerRoom;
         SceneEvents.OnFullViewPartChange(FullViewPart.BoilerRoom);
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 切换至生活区
 /// </summary>
 private void SwitchToLivingQuarters(bool value)
 {
     ToggleTextAlphaChange(fullViewUI.livingQuaterToggle, value);
     if (value)
     {
         isFullView  = true;
         currentPart = FullViewPart.LivingQuarters;
         SceneEvents.OnFullViewPartChange(FullViewPart.LivingQuarters);
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// 切换至水处理区
 /// </summary>
 private void SwitchToWaterTreatmentArea(bool value)
 {
     ToggleTextAlphaChange(fullViewUI.waterTreatmentToggle, value);
     if (value)
     {
         isFullView  = true;
         currentPart = FullViewPart.WaterTreatmentArea;
         SceneEvents.OnFullViewPartChange(FullViewPart.WaterTreatmentArea);
     }
 }
Exemplo n.º 12
0
    // called when node selected
    public void NodeSelected(TreeNode <TreeViewItem> node)
    {
        Debug.Log(node.Item.Name + " selected");
        PhysicalTopology topoNode = node.Item.Tag as PhysicalTopology;

        if (topoNode != null)
        {
            SceneEvents.OnTopoNodeChanged(topoNode);
        }
    }
Exemplo n.º 13
0
 /// <summary>
 /// 切换至气能源区
 /// </summary>
 private void SwitchToGasEnergyArea(bool value)
 {
     ToggleTextAlphaChange(fullViewUI.gasEnergyToggle, value);
     if (value)
     {
         isFullView  = true;
         currentPart = FullViewPart.GasEnergyArea;
         SceneEvents.OnFullViewPartChange(FullViewPart.GasEnergyArea);
     }
 }
Exemplo n.º 14
0
    }                                            //In game timer

    #region MonoBehavior

    private void Awake()
    {
        instance = this;

        SceneEvents.Initialize();

        gameState = GameStates.MainMenu;
        Health    = 3;
        Coins     = 0;
    }
Exemplo n.º 15
0
 /// <summary>
 /// 切换至主区域
 /// </summary>
 private void SwitchToMainBuilding(bool value)
 {
     ToggleTextAlphaChange(fullViewUI.mainBuildingToggle, value);
     if (value)
     {
         isFullView  = true;
         currentPart = FullViewPart.MainBuilding;
         SceneEvents.OnFullViewPartChange(FullViewPart.MainBuilding);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// 切换到整厂
 /// </summary>
 /// <param name="value"></param>
 private void SwitchToFullFactory(bool value)
 {
     ToggleTextAlphaChange(fullViewUI.fullFactoryToggle, value);
     if (value)
     {
         isFullView  = true;
         currentPart = FullViewPart.FullFactory;
         SceneEvents.OnFullViewPartChange(FullViewPart.FullFactory);
     }
 }
Exemplo n.º 17
0
 private void destroySkeletonandID(long id)
 {
     //	print ("removing " + id);
     if (bagOfBonesDictionary.ContainsKey(id))
     {
         Transform skeleton = bagOfBonesDictionary[id][0].BoneGameObject.transform.parent;
         SceneEvents.SkeletonUserDestroy(skeleton, id);
         Destroy(skeleton.gameObject);
         bagOfBonesDictionary.Remove(id);
     }
     userIDs.Remove(id);
 }
Exemplo n.º 18
0
 /// <summary>
 /// 连接成功
 /// </summary>
 /// <param name="info"></param>
 private void OnConnect(string info)
 {
     CommunicationObject.IsConnect = true;
     if (!IsConnect)
     {
         IsConnect = true;
         if (GlobalTipsManage.Instance)
         {
             GlobalTipsManage.Instance.Close();
         }
         SceneEvents.OnConnectStateChange(SceneEvents.ServerConnectState.reConnect);
     }
 }
Exemplo n.º 19
0
 /// <summary>
 /// 连接失败
 /// </summary>
 /// <param name="errorInfo"></param>
 private void OnDisConnect(string errorInfo)
 {
     CommunicationObject.IsConnect = false;
     if (IsConnect)
     {
         IsConnect = false;
         if (GlobalTipsManage.Instance)
         {
             GlobalTipsManage.Instance.Show(errorMsg, true);
         }
         SceneEvents.OnConnectStateChange(SceneEvents.ServerConnectState.disConnect);
     }
 }
Exemplo n.º 20
0
        private void AssignDelegate(object target, ReflectionData reflectionData)
        {
            SceneEvents events;

            if (!_sceneEvents.TryGetValue(reflectionData.Attribute.Scene, out events))
            {
                events = new SceneEvents();
                _sceneEvents.Add(reflectionData.Attribute.Scene, events);
            }
            events.Add(
                reflectionData.Attribute.SceneEventType,
                (Action)Delegate.CreateDelegate(typeof(Action), target, reflectionData.MethodInfo));
        }
    /// <summary>
    /// 创建厂区设备
    /// </summary>
    public void CreateFactoryDev()
    {
        //添加门控制脚本
        InitDoorAccessModelAdd();

        //创建区域设备
        if (SystemSettingHelper.deviceSetting.LoadParkDevWhenEnter)
        {
            CreateParkDevs(() =>
            {
                SceneEvents.OnDepCreateCompleted(this);
            });
        }
    }
Exemplo n.º 22
0
        IEnumerator ToMainMenu()
        {
            IsMenu = true;

            // AudioController.Pause();

            yield return(new WaitForSeconds(3.0f));

            SceneEvents.ChangeScene("Title");

            yield return(new WaitForSeconds(1.5f));

            // AudioController.Restart();
        }
Exemplo n.º 23
0
    /// <summary>
    /// 进入全景模式
    /// </summary>
    public void SwitchToFullView()
    {
        isFullView = true;
        Log.Error("FullViewController->返回首页!");
        if (SystemModeTweenManage.Instance != null && SystemModeTweenManage.Instance.IsStartTween == false)
        {
            Log.Info("FullViewController.SystemModeTweenManage.TweenSequence rewind start.");
            SystemModeTweenManage.Instance.TweenSequence.OnRewind(() =>
            {
                Log.Info("FullViewController.SystemModeTweenManage.TweenSequence rewind end.");
                SystemModeTweenManage.Instance.KillModdleTween();
                Log.Info("FullViewController.SwitchToFullView.TransferAnimation start.");
                TransferAnimation.DoTransferAnimation(() =>
                {
                    Log.Info("FullViewController.SwitchToFullView.TransferAnimation end.");
                    currentPart = FullViewPart.MainBuilding;
                    if (FullViewCameraPath.Instance)
                    {
                        FullViewCameraPath.Instance.OnViewChange(true);
                    }
                    Log.Info("FullViewController.SceneEvents.OnFullViewStateChange:" + IsFullView);
                    SceneEvents.OnFullViewStateChange(isFullView);
                });
            }).PlayBackwards();

            //进入视图初始化
        }
        else
        {
            Log.Info("FullViewController.SwitchToFullView. without tween.");
            currentPart = FullViewPart.MainBuilding;
            if (FullViewCameraPath.Instance)
            {
                FullViewCameraPath.Instance.OnViewChange(true);
            }
            SceneEvents.OnFullViewStateChange(isFullView);
        }

        if (SceneAssetManager.Instance)
        {
            SceneAssetManager.Instance.SetEnableLoadBuilding(false);
        }
    }
Exemplo n.º 24
0
    //private void InitDevContainer()
    //{
    //    if (_roomDevContainer != null) return;
    //    _roomDevContainer = new GameObject("RoomDevContainer");
    //    _roomDevContainer.transform.parent = transform;
    //    FloorController floor = ParentNode as FloorController;
    //    if (floor)
    //    {
    //        if (monitorRangeObject != null)
    //        {
    //            transform.position = monitorRangeObject.transform.position;
    //        }
    //        Transform parentCotainer = floor.RoomDevContainer.transform;
    //        _roomDevContainer.transform.position = parentCotainer.position;
    //        _roomDevContainer.transform.eulerAngles = parentCotainer.eulerAngles;
    //        _roomDevContainer.transform.localScale = parentCotainer.lossyScale;
    //    }
    //}
    ///// <summary>
    ///// 隐藏机房设备
    ///// </summary>
    //public void HideRoomDev()
    //{
    //    RoomDevContainer.SetActive(false);
    //}
    ///// <summary>
    ///// 显示机房设备
    ///// </summary>
    //public void ShowRoomDev()
    //{
    //    RoomDevContainer.SetActive(true);
    //}

    public override void FocusOn(Action onDevCreateFinish = null)
    {
        IsFocus = true;
        //OnDevCreateComplete = onDevCreateFinish;
        //DepNode lastDep = FactoryDepManager.currentDep;
        //FactoryDepManager.currentDep = this;
        //SceneEvents.OnDepNodeChanged(lastDep, this);

        SceneEvents.OnDepNodeChanged(this);
        //Todo:摄像头聚焦
        AlignTarget alignTargetTemp;

        alignTargetTemp = monitorRangeObject != null?GetTargetInfo(monitorRangeObject.gameObject) : GetTargetInfo(gameObject);

        CameraSceneManager camera = CameraSceneManager.Instance;

        //FlashingRoom();
        camera.FocusTargetWithTranslate(alignTargetTemp, AreaSize, AfterRoomFocus);
    }
    /// <summary>
    /// 展开楼层
    /// </summary>
    /// <param name="IsImmediately">是否立即展开</param>
    public void OpenFloor(bool IsImmediately = false)
    {
        IsFloorExpand = true;//要放到外面
        if (isExpandFloor)
        {
            if (FloorTween)
            {
                ShowTweenObject(false);
                isTweening = true;
                SceneEvents.OnBuildingOpenStartAction();
                FloorTween.OpenBuilding(IsImmediately, () =>
                {
                    if (isHideWall)
                    {
                        HideWalls();
                    }
                    isTweening = false;
                    SetFloorCollider(true);
                    Debug.Log("Open Building Complete!");
                    SceneEvents.OnBuildingOpenCompleteAction(this);
                    OnAfterOpenFloor();
                    //HideBuildTypePerson();

                    var loader = NavMeshSceneLoader.Instance;
                    if (loader)
                    {
                        loader.LoadSceneWhenExpand();
                    }
                });
            }
        }
        else
        {
            if (isHideWall)
            {
                HideWalls();
            }
            SetBuildingCollider(false);
            SceneEvents.OnBuildingOpenCompleteAction(this);
            OnAfterOpenFloor();
        }
        //LoadDevices();
    }
    /// <summary>
    /// 楼层收起
    /// </summary>
    /// <param name="IsImmediately">是否立刻收起</param>
    public void CloseFloor(bool IsImmediately = false)
    {
        if (isExpandFloor)
        {
            if (FloorTween)
            {
                isTweening = true;
                SceneEvents.OnBuildingStartCloseAction();
                FloorTween.CloseBuilding(IsImmediately, () =>
                {
                    isTweening    = false;
                    IsFloorExpand = false;
                    SetFloorCollider(false);
                    ShowTweenObject(true);
                    Debug.Log("Close Building Complete!");
                    SceneEvents.OnBuildingCloseCompleteAction();
                    if (isHideWall)
                    {
                        ShowWalls();
                    }

                    var loader = NavMeshSceneLoader.Instance;
                    if (loader)
                    {
                        loader.LoadSceneWhenCollapse();
                    }
                });
            }
        }
        else
        {
            SetBuildingCollider(true);
            if (isHideWall)
            {
                ShowWalls();
            }
        }
    }
Exemplo n.º 27
0
    /// <summary>
    /// 进入电厂
    /// </summary>
    private void EnterFactory()
    {
        try
        {
            Log.Info("FullViewController.enter facotry start...");
            SystemModeTweenManage.Instance.SetStartTween();

            Log.Info("FullViewController.tween sequence start...");
            SystemModeTweenManage.Instance.TweenSequence.OnComplete(() =>
            {
                ParkInformationManage.Instance.ShowParkInfoUI(true);
                Log.Info("FullViewController.tween sequence end...");
                SystemModeTweenManage.Instance.IsStartTween = false;
                SystemModeTweenManage.Instance.ModdleTween();
            }).Restart();
            if (AlarmPushManage.Instance)
            {
                AlarmPushManage.Instance.ShowIsShow();
            }
            FactoryDepManager dep = FactoryDepManager.Instance;
            if (dep)
            {
                Log.Info("FullViewController.start creat factory dev...");
                dep.CreateFactoryDev();
                Log.Info("FullViewController.creat factory dev complete.");
            }
            IsDoingAnimation = false;
            isFullView       = false;
            Log.Info("FullViewController.enter factory event start...");
            SceneEvents.OnFullViewStateChange(isFullView);
            //MonitorRangeManager.Instance.ShowRanges(SceneEvents.DepNode);
            IsClickUGUIorNGUI.Instance.Recover();//解决鼠标右键旋转场景时,会跳一下的的问题(是IsClickUGUIorNGUI中鼠标点击检测问题)
        }catch (Exception e)
        {
            Log.Error("Error:FullViewController enter factory:" + e.ToString());
        }
    }
    /// <summary>
    /// 打开区域
    /// </summary>
    /// <param name="onComplete"></param>
    public override void OpenDep(Action onComplete = null, bool isFocusT = true)
    {
        ShowFactory();
        if (NodeObject == null)
        {
            if (onComplete != null)
            {
                onComplete();
            }
            Debug.Log("DepObject is null...");
            return;
        }
        else
        {
            ShowBuildingDev(true);
            FactoryDepManager.Instance.HideOtherBuilding(this);
            if (isFocusT)
            {
                FocusOn(onComplete);
            }
            else
            {
                if (onComplete != null)
                {
                    onComplete();
                }
            }
            //DepNode lastDep = FactoryDepManager.currentDep;
            //lastDep.IsFocus = false;
            //FactoryDepManager.currentDep = this;
            //SceneEvents.OnDepNodeChanged(lastDep, FactoryDepManager.currentDep);

            FactoryDepManager.currentDep.IsFocus = false;
            SceneEvents.OnDepNodeChanged(this);
        }
    }
Exemplo n.º 29
0
 // Start a new single player game
 public void StartSinglePlayer()
 {
     AudioController.PlayClick();
     SceneEvents.ChangeScene("SinglePlayer");
     UIEvents.StartGame();
 }
 void OnDisable()
 {
     SceneEvents.UnSubscribePerLevelEvents();
 }