Ejemplo n.º 1
0
 public static void SetDefaultMode()
 {
     if (IsDotsModeActive)
     {
         ModeService.ChangeModeById(k_DefaultId);
     }
 }
Ejemplo n.º 2
0
 public static void SetDotsMode()
 {
     if (!IsDotsModeActive)
     {
         ModeService.ChangeModeById(k_DotsId);
     }
 }
Ejemplo n.º 3
0
        void CheckImguiOverride()
        {
            var hasOverride = ModeService.HasExecuteHandler("gui_playbar");

            m_ImguiOverride.style.display  = hasOverride ? DisplayStyle.Flex : DisplayStyle.None;
            m_ImguiOverride.onGUIHandler   = hasOverride ? (Action)OverrideGUIHandler : null;
            m_UIElementsRoot.style.display = hasOverride ? DisplayStyle.None : DisplayStyle.Flex;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns a new score processor instance that would've been used for the current map.
 /// </summary>
 public IScoreProcessor GetScoreProcessor()
 {
     if (map.Value == null)
     {
         return(null);
     }
     return(ModeService.CreateScoreProcessor());
 }
Ejemplo n.º 5
0
        void HandleModeChanged(ModeService.ModeChangedArgs args)
        {
            // Install profile specific to the current mode.
            var shortcutProfiles = ModeService.GetModeDataSection(args.nextIndex, ModeService.k_ShortcutSectionName) as System.Collections.IList;

            if (shortcutProfiles == null || shortcutProfiles.Count == 0)
            {
                return;
            }

            // Rebuild shortcuts so all shortcuts bound to invisible menu items are removed.
            RebuildShortcuts();

            string defaultMode = null;

            try
            {
                var shortcutProfilePath = ShortcutProfileStore.GetShortcutFolderPath();
                if (!System.IO.Directory.Exists(shortcutProfilePath))
                {
                    System.IO.Directory.CreateDirectory(shortcutProfilePath);
                }
                for (var i = 0; i < shortcutProfiles.Count; ++i)
                {
                    var srcProfilePath = shortcutProfiles[i] as string;
                    if (String.IsNullOrEmpty(srcProfilePath) || !File.Exists(srcProfilePath))
                    {
                        continue;
                    }
                    var baseName = Path.GetFileName(srcProfilePath);
                    var dstPath  = Path.Combine(shortcutProfilePath, baseName);
                    if (!File.Exists(dstPath))
                    {
                        File.Copy(srcProfilePath, dstPath);
                    }

                    if (i == 0)
                    {
                        // Assume first item is the default mode if needed.
                        defaultMode = Path.GetFileNameWithoutExtension(srcProfilePath);
                    }
                }
            }
            catch (Exception)
            {
                Debug.LogError("Error while installing new profile for mode: " + ModeService.currentId);
            }

            // Reload profiles will unset the lastUsedProfile so make a copy of it:
            var lastUsedProfileId = m_LastUsedProfileIdProvider.lastUsedProfileId ?? defaultMode;

            if (!String.IsNullOrEmpty(lastUsedProfileId))
            {
                profileManager.ReloadProfiles();
                LoadProfileById(lastUsedProfileId);
            }
        }
 public RequestRepository()
 {
     _clientRepository = new ClientRepository();
     _itemRepository = new ItemRepository();
     _unitOfIssueRepository = new UnitRepository();
     _modeService = new ModeService();
     _paymentTermService = new PaymentTermRepository();
     _orderStatusService = new OrderStatusService();
     _manufacturerRepository = new ManufacturerRepository();
     _physicalStoreRepository = new PhysicalStoreRepository();
     _activityRepository = new ActivityRepository();
 }
Ejemplo n.º 7
0
        static List <MenuItemData> GetSortedMenuItems(UnityEngine.GameObject[] targets)
        {
            var menus    = Unsupported.GetSubmenus("Component");
            var commands = Unsupported.GetSubmenusCommands("Component");

            var          menuItems       = new List <MenuItemData>(menus.Length);
            var          legacyMenuItems = new List <MenuItemData>(menus.Length);
            const string kLegacyString   = "legacy";

            var hasFilterOverride = ModeService.HasExecuteHandler("inspector_filter_component");

            for (var i = 0; i < menus.Length; i++)
            {
                var  menuPath = menus[i];
                bool isLegacy = menuPath.ToLower().Contains(kLegacyString);
                var  item     = new MenuItemData
                {
                    path     = menuPath,
                    command  = commands[i],
                    isLegacy = isLegacy
                };

                if (!hasFilterOverride || ModeService.Execute("inspector_filter_component", targets, menuPath))
                {
                    if (isLegacy)
                    {
                        legacyMenuItems.Add(item);
                    }
                    else
                    {
                        menuItems.Add(item);
                    }
                }
            }

            int comparison(MenuItemData x, MenuItemData y) => string.CompareOrdinal(x.path, y.path);

            menuItems.Sort(comparison);
            legacyMenuItems.Sort(comparison);

            menuItems.AddRange(legacyMenuItems);

            return(menuItems);
        }
Ejemplo n.º 8
0
        void OpenModesDropdown()
        {
            GenericMenu menu  = new GenericMenu();
            var         modes = ModeService.modeNames;

            for (var i = 0; i < modes.Length; i++)
            {
                var modeName = ModeService.modeNames[i];
                int selected = i;
                menu.AddItem(
                    new GUIContent(modeName),
                    ModeService.currentIndex == i,
                    () =>
                {
                    EditorApplication.delayCall += () => ModeService.ChangeModeByIndex(selected);
                });
            }
            menu.DropDown(worldBound, true);
        }
Ejemplo n.º 9
0
        public Logic(DeviceManager deviceManager, ServiceManager serviceManager)
        {
            mDeviceManager  = deviceManager;
            mServiceManager = serviceManager;

            mWake = GetService <WakeOnLanService>();

            mMode = GetService <ModeService>();

            if (mMode != null)
            {
                mMode.OnModeChange += OnModeChange;
            }

            mScene = GetService <SceneService>();
            if (mScene != null)
            {
                mScene.OnSceneEvent += OnSceneEvent;
            }

            mEvents = GetService <EventService>();
            if (mEvents != null)
            {
                mEvents.OnEvent += OnExternalEvent;
            }

            // Livingroom
            mCurtainLivingroom = (CurtainDevice)deviceManager.GetDevice("curtain_livingroom");
            mProjector         = (EpsonDevice)deviceManager.GetDevice("projector");
            mReceiver          = (YamahaDevice)deviceManager.GetDevice("receiver");
            mLampLivingroom    = (NexaLampDevice)deviceManager.GetDevice("lamp_livingroom");
            mLampTable         = (NexaLampDevice)deviceManager.GetDevice("lamp_table");
            mLampWindow        = (NexaLampDevice)deviceManager.GetDevice("lamp_window");
            mLampDarthLeft     = (ArduinoLamps.LampDevice)deviceManager.GetDevice("lamp_darth_left");
            mLampDarthRight    = (ArduinoLamps.LampDevice)deviceManager.GetDevice("lamp_darth_right");
            mMotionLivingroom  = (NexaSensorDevice)deviceManager.GetDevice("motion_livingroom");

            mSwitchSofa1 = (NexaSensorDevice)deviceManager.GetDevice("switch_sofa1");
            mSwitchSofa2 = (NexaSensorDevice)deviceManager.GetDevice("switch_sofa2");
            if (mSwitchSofa1 != null)
            {
                mSwitchSofa1.OnDeviceEvent += OnSofaSwitchEvent;
            }
            if (mSwitchSofa2 != null)
            {
                mSwitchSofa2.OnDeviceEvent += OnSofaSwitchEvent;
            }

            mDesktop = (ComputerProxyDevice)deviceManager.GetDevice("desktop");

            // Bedroom
            mCurtainBedroom = (CurtainDevice)deviceManager.GetDevice("curtain_bedroom");
            mLampBedroom    = (NexaLampDevice)deviceManager.GetDevice("lamp_bedroom");
            mLampBed        = (NexaLampDevice)deviceManager.GetDevice("lamp_bed");

            // Hallway
            mLampHallway = (NexaLampDevice)deviceManager.GetDevice("lamp_hallway");
            mMotionDoor  = (NexaSensorDevice)deviceManager.GetDevice("motion_door");
            if (mMotionDoor != null)
            {
                mMotionDoor.OnDeviceEvent += OnDoorSensor;
            }

            mSwitchHallway = (NexaSensorDevice)deviceManager.GetDevice("switch_hallway");
            if (mSwitchHallway != null)
            {
                mSwitchHallway.OnDeviceEvent += OnHallwaySwitch;
            }

            // Presence devices
            mGalaxyS7 = (BluetoothDevice)deviceManager.GetDevice("presence_s7");
            if (mGalaxyS7 != null)
            {
                mGalaxyS7.OnDeviceEvent += OnBluetoothEvent;
            }

            mSpeech = GetService <SpeechService>();
            if (mSpeech != null)
            {
                var commands = new List <DeviceBase.VoiceCommand>();
                commands.Add(new DeviceBase.VoiceCommand("activate night mode", () => { MacroNight(); }));

                mSpeech.LoadCommands(commands);
            }

            Speak("System ready");
        }
Ejemplo n.º 10
0
 void CheckAvailability()
 {
     style.display = ModeService.HasCapability(ModeCapability.Playbar, true) ? DisplayStyle.Flex : DisplayStyle.None;
 }
Ejemplo n.º 11
0
 static void OverrideGUIHandler()
 {
     ModeService.Execute("gui_playbar", EditorApplication.isPlayingOrWillChangePlaymode);
 }
Ejemplo n.º 12
0
 void CheckAvailability()
 {
     style.display = ModeService.HasCapability(ModeCapability.LayoutWindowMenu, true) ? DisplayStyle.Flex : DisplayStyle.None;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Event called on current map change.
 /// </summary>
 private void OnMapChange(IPlayableMap map)
 {
     hitTiming = map == null ? null : ModeService.CreateTiming();
 }