Beispiel #1
0
 private void ConfigForm_Load(object sender, EventArgs e)
 {
     setting      = SettingDAL.GetSetting();
     lightcontrol = LightConrolDAL.GetLights();
     LayoutIni(setting, lightcontrol);
     LLSDK.WinAPI.Window.SetWindowAlwaysTop(this.Handle);
 }
    void RpcSendSceneState(NodeState[] nodeStates, float lightIntensity, bool fading, bool prevstate)
    {
        if (WaveSpawner.Instance.playerID == 0 || WaveSpawner.Instance.playerID == -1)
        {
            return;                                                                             //host and server shouldnt recieve state updates
        }
        Shop shop = FindObjectOfType <Shop>();

        foreach (Transform node in Nodes.nodes) //for each node on the map, check if it has a turret
        {
            Node nodeComponent = node.GetComponent <Node>();
            foreach (NodeState state in nodeStates) //if there is a state for that nodeID, update the node
            {
                if (nodeComponent.nodeID == state.nodeID)
                {
                    nodeComponent.BuildTurret(shop.Blueprints[state.turretID]);
                    if (state.isUpgraded)
                    {
                        nodeComponent.UpgradeTurret();
                    }
                    break;
                }
            }
            //match lightcontroller to hosts
            LightControl lightCon = FindObjectOfType <LightControl>();
            lightCon.directionalLight.intensity = lightIntensity;
            lightCon.fading    = fading;
            lightCon.prevState = prevstate;
        }
    }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Test connected light strips");
            Console.WriteLine("Enter number of LEDs:");

            var numberinput = Console.ReadLine();
            int total       = int.Parse(numberinput);

            testLc = new LightControl(total);

            var bgTask = Task.Run(CyclePattern);

            while (true)
            {
                Console.WriteLine("Input an R,G,B value:");
                var testinput = Console.ReadLine();

                if (testinput.ToLowerInvariant() == "rainbow")
                {
                    demoPattern = true;
                }
                else
                {
                    demoPattern = false;
                    var values    = testinput.Split(",");
                    var testColor = new Colour(255, int.Parse(values[0]), int.Parse(values[1]), int.Parse(values[2]));
                    testLc.ClearStack(testColor);
                    Console.WriteLine($"Strip set to {testColor}");
                }
            }
        }
Beispiel #4
0
        public bool getRedWE()
        {
            LightControl lc = new LightControl();

            redStopWE = lc.getRedStatus();
            return(redStopWE);
        }
Beispiel #5
0
 public override void ResetFunctionToDefault()
 {
     lightControl = new LightControl();
     modeAccess   = 1;
     modeConst    = 1;
     whileHeld    = false;
 }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        currentCapacity = 0;
        lightControl    = GetComponent <LightControl> ();
        bb = GetComponent <BuildingBehaivor3> ();

        StartCoroutine("chargingBatteryBehaivor");
    }
Beispiel #7
0
 public EventHandler(Plugin plugin)
 {
     this.plugin         = plugin;
     CustomPlayerManager = new CustomPlayerManager(plugin);
     LightControl        = new LightControl(plugin);
     Broadcasts          = new Broadcasts(plugin);
     ManualEndGame       = new ManualEndGame(plugin);
 }
Beispiel #8
0
        private void OnSceneObjectSelected(BasicMessage m)
        {
            var soMessage   = m as GenericMessage <SceneObject>;
            var sceneObject = soMessage != null ? soMessage.Value : null;

            if (sceneObject != null)
            {
                var soEdition = new SceneObjectControl(sceneObject);
                var transform = new TransformControl(sceneObject.Transform);

                componentContainer.Children.Add(soEdition);
                componentContainer.Children.Add(transform);

                Control      control      = null;
                MeshRenderer meshRenderer = null;
                Camera       camera       = null;
                Light        light        = null;
                Collider     collider     = null;

                foreach (var component in sceneObject.Components)
                {
                    meshRenderer = component as MeshRenderer;
                    if (meshRenderer != null)
                    {
                        control = new MeshRendererControl(meshRenderer);
                        componentContainer.Children.Add(control);
                        continue;
                    }

                    camera = component as Camera;
                    if (camera != null)
                    {
                        control = new CameraControl(camera);
                        componentContainer.Children.Add(control);
                        continue;
                    }

                    light = component as Light;
                    if (light != null)
                    {
                        control = new LightControl(light);
                        componentContainer.Children.Add(control);
                        continue;
                    }

                    collider = component as Collider;
                    if (collider != null)
                    {
                        control = new ColliderControl(collider);
                        componentContainer.Children.Add(control);
                        continue;
                    }
                }

                MainTabControl.SelectedItem = MainTabControl.Items[0];
            }
        }
Beispiel #9
0
        public static void UpdateLights(LightControl set)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("Enable", set.Enable.ToString());
            dic.Add("LightID", set.Address);
            dic.Add("LightInit", set.NormState);
            dic.Add("RemoteIP", set.RemoteIP);
            dic.Add("LightPort", set.StrPorts);
            LLSDK.Xml.XmlHelper.Update("/Data/Light", dic);
        }
Beispiel #10
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     // Perform any additional setup after loading the view, typically from a nib.
     image        = UIImage.FromBundle(BusinessLogic.getImage(toggle));
     lightControl = new LightControl(View.Frame);
     lightControl.SetLabelTextWithText(BusinessLogic.getRoom());
     lightControl.SetImageWithImage(image);
     lightControl.SetSwitchValueWithValue(toggle);
     View.AddSubview(lightControl);
 }
Beispiel #11
0
        public void SetGuidLight(int pos, LightControl con)
        {
            WFSSIUSETGUIDLIGHT guidLight = new WFSSIUSETGUIDLIGHT();

            guidLight.fwCommand  = con;
            guidLight.wGuidLight = (ushort)pos;
            IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WFSSIUSETGUIDLIGHT)));

            Marshal.StructureToPtr(guidLight, ptr, false);
            int hResult = XfsApi.WFSAsyncExecute(hService, SIUDefinition.WFS_CMD_SIU_SET_GUIDLIGHT, ptr, 0, Handle, ref requestID);
        }
Beispiel #12
0
 public static ApiLightControl Map(LightControl lc)
 {
     return(lc != null ? new ApiLightControl
     {
         ColorHex = lc.ColorHex,
         ColorX = lc.ColorX,
         ColorY = lc.ColorY,
         Dimmer = lc.Dimmer,
         ID = lc.ID,
         Mireds = lc.Mireds,
         State = lc.State == Bool.True
     } : null);
 }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (GUILayout.Button("Change meter 1") && meter != null)
     {
         ((MeterControl)meter.objectReferenceValue).Value = meterNum.intValue;
         Debug.Log("changed meter to " + meterNum.intValue.ToString());
     }
     if (GUILayout.Button("Toggle Light") && light != null)
     {
         LightControl lightRef = ((LightControl)light.objectReferenceValue);
         lightRef.Lit = !lightRef.Lit;
     }
 }
Beispiel #14
0
        public static LightControl GetLights()
        {
            LightControl set  = new LightControl();
            var          attr = LLSDK.Xml.XmlHelper.GetSingleNodeAttr("/Data/Light");

            if (null != attr)
            {
                set.Enable    = bool.Parse(attr["Enable"]);
                set.Address   = attr["LightID"];
                set.NormState = attr["LightInit"];
                set.RemoteIP  = attr["RemoteIP"];
                set.Ports     = new List <string>(attr["LightPort"].Split(','));
                set.StrPorts  = attr["LightPort"];
            }
            return(set);
        }
Beispiel #15
0
    override public void DoEffect(Arrow arrow)
    {
        if (effected)
        {
            return;
        }
        effected = true;
        // Dim the lights to create a dark scene
        LightControl l = GameObject.FindObjectOfType(typeof(LightControl)) as LightControl;

        l.TurnDark();
        createExplosion();

        createSound();
        recycle();
        Destroy(arrow.gameObject);
    }
Beispiel #16
0
        private void LayoutIni(Setting set, LightControl light)
        {
            skinTextBoxXpos.SkinTxt.Text   = set.ClientRec.X.ToString();
            skinTextBoxYpos.SkinTxt.Text   = set.ClientRec.Y.ToString();
            skinTextBoxWidth.SkinTxt.Text  = set.ClientRec.Width.ToString();
            skinTextBoxHeight.SkinTxt.Text = set.ClientRec.Height.ToString();

            lightEnable.Checked    = light.Enable;
            skinComboBoxState.Text = light.NormState;
            skinTextBoxChipID.Text = light.Address;
            skinTextBoxIP.Text     = light.RemoteIP;
            skinTextBoxPorts.Text  = light.StrPorts;

            skinTextBoxListenPort.Text = setting.Port.ToString();
            skinComboBoxCirPlay.Text   = set.CirPlay?"是":"否";
            skinComboBoxHideCur.Text   = set.HideCur?"是":"否";
        }
    void RpcGetSceneState()                     //get the scene on the host, then send it to the client
    {
        if (WaveSpawner.Instance.playerID == 0) //only the host should get and send scene state
        {
            float       lightIntensity = 1;
            NodeState[] nodeStates     = new NodeState[Nodes.nodes.Length];
            Shop        shop           = FindObjectOfType <Shop>();
            int         j = 0; //iterator for nodeStates[]

            //get scene data (nodes data and light intensity)
            foreach (Transform node in Nodes.nodes) //for each node on the map, check if it has a turret
            {
                Node nodeComponent = node.GetComponent <Node>();
                if (nodeComponent.turretBlueprint == null)
                {
                    continue;                                           //if it has no turret, ignore and check next node
                }
                for (int i = 0; i < shop.Blueprints.Length; ++i)
                {
                    if (nodeComponent.turretBlueprint == shop.Blueprints[i])    //if it has a turret, compare it to the turrets in the shop to get its ID
                    {
                        nodeStates[j].nodeID     = nodeComponent.nodeID;
                        nodeStates[j].turretID   = i; //blueprints index matches turret to build index
                        nodeStates[j].isUpgraded = nodeComponent.isUpgraded;
                        j++;
                        break;
                    }
                }
            }

            Array.Resize(ref nodeStates, j);

            LightControl lightCon = FindObjectOfType <LightControl>();
            lightIntensity = lightCon.directionalLight.intensity;
            bool fading    = lightCon.fading;
            bool prevstate = lightCon.prevState;

            CmdSendSceneState(nodeStates, lightIntensity, fading, prevstate);
        }
    }
Beispiel #18
0
 public Light(Scene scene)
 {
     Control = new LightControl(this, scene);
 }
Beispiel #19
0
 public void SetGuidLight(GuidLights pos, LightControl con)
 {
     SetGuidLight((int)pos, con);
 }
Beispiel #20
0
 void Start()
 {
     lightControl = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<LightControl>();
     child = transform.GetChild(0);
 }
Beispiel #21
0
 public MediaController(APlayer player) : base(player)
 {
     setting      = SettingDAL.GetSetting();
     lightcontrol = LightConrolDAL.GetLights();
 }
Beispiel #22
0
        /// <summary>
        /// Show the PopUp custom UI.
        /// </summary>
        private void ShowPopupControl(string popupControl, Entity entity, IEnumerable <Entity> childrenEntities = null)
        {
            UserControl popupContent;

            switch (popupControl)
            {
            case nameof(LightControl):
                popupContent            = new LightControl(entity, childrenEntities);
                NotifyPopupEntityUpdate = (popupContent as LightControl).EntityUpdated;
                break;

            case nameof(MediaControl):
                popupContent            = new MediaControl(entity);
                NotifyPopupEntityUpdate = (popupContent as MediaControl).EntityUpdated;
                break;

            case nameof(ClimateControl):
                popupContent            = new ClimateControl(entity);
                NotifyPopupEntityUpdate = (popupContent as ClimateControl).EntityUpdated;
                break;

            case nameof(SettingsControl):
                popupContent = new SettingsControl();
                break;

            case nameof(ThemeControl):
                popupContent = new ThemeControl(LoadFrame);
                break;

            case nameof(WebLinkControl):
                popupContent = new WebLinkControl(entity, ActualWidth, ActualHeight);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (popupContent != null)
            {
                // When a entity-updated callback is requested, keep track of the entity
                // which the pop-up control is monitoring.
                if (null != NotifyPopupEntityUpdate)
                {
                    PopupEntity = entity;
                }

                Popup popup = new Popup()
                {
                    IsLightDismissEnabled   = true,
                    LightDismissOverlayMode = LightDismissOverlayMode.On,
                    Child = popupContent,
                };

                popup.Closed += async(s, re) =>
                {
                    PopupEntity             = null;
                    NotifyPopupEntityUpdate = null;

                    if (popup.Child is SettingsControl)
                    {
                        // Save application settings when closing the Settings popup
                        if ((popup.Child as SettingsControl).SaveSettings())
                        {
                            // Settings value changed, so update frame, reconnect to MQTT and refresh al tiles
                            await LoadFrame();

                            await MqttSubscriber.Connect();

                            await UpdateEntitiesSinceLastUpdate(default(DateTime));
                        }
                    }
                    else if (popup.Child is ThemeControl)
                    {
                        this.RequestedTheme = ThemeControl.GetApplicationTheme();
                    }
                };

                popupContent.Loaded += (s, re) =>
                {
                    UserControl userControl = s as UserControl;

                    popup.HorizontalOffset = Window.Current.Bounds.Width / 2 - userControl.ActualWidth / 2;
                    popup.VerticalOffset   = Window.Current.Bounds.Height / 2 - userControl.ActualHeight / 2;
                };

                popup.IsOpen = true;
            }
        }
Beispiel #23
0
 private void Awake()
 {
     Instance = this;
 }
Beispiel #24
0
 public void OnDeserialization(Scene scene)
 {
     Control = new LightControl(this, scene);
 }