public void resetOther(CustomToggle toggle)
 {
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i] != toggle)
         {
             list[i].Reset();
         }
     }
 }
 static int Reset(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         CustomToggle obj = (CustomToggle)ToLua.CheckObject(L, 1, typeof(CustomToggle));
         obj.Reset();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
예제 #3
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        CustomToggle component = (CustomToggle)target;

        if (component.isOn)
        {
            component.GraphicIsOff.enabled = false;
        }
        else
        {
            component.GraphicIsOff.enabled = true;
        }
    }
 static int btnClick(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         CustomToggle           obj  = (CustomToggle)ToLua.CheckObject(L, 1, typeof(CustomToggle));
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.GameObject));
         obj.btnClick(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int set_choosen(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CustomToggle       obj  = (CustomToggle)o;
            UnityEngine.Sprite arg0 = (UnityEngine.Sprite)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Sprite));
            obj.choosen = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index choosen on a nil value" : e.Message));
        }
    }
    static int set_group(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CustomToggle      obj  = (CustomToggle)o;
            CustomToggleGroup arg0 = (CustomToggleGroup)ToLua.CheckUnityObject(L, 2, typeof(CustomToggleGroup));
            obj.group = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index group on a nil value" : e.Message));
        }
    }
    static int get_choosen(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CustomToggle       obj = (CustomToggle)o;
            UnityEngine.Sprite ret = obj.choosen;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index choosen on a nil value" : e.Message));
        }
    }
    static int get_group(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            CustomToggle      obj = (CustomToggle)o;
            CustomToggleGroup ret = obj.group;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index group on a nil value" : e.Message));
        }
    }
예제 #9
0
        public async Task <CustomToggle> UpdateCustomToggle(CustomToggle customToggle)
        {
            var toggle = _context.CustomToggle.Find(customToggle.CustomToggleId);

            if (toggle == null)
            {
                return(customToggle);
            }

            toggle.Image      = customToggle.Image;
            toggle.ToggleText = customToggle.ToggleText;
            try
            {
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(toggle);
        }
예제 #10
0
 public async Task <CustomToggle> InsertCustomToggle(CustomToggle customToggle)
 {
     return(await _repo.Add(customToggle));
 }
예제 #11
0
        public override bool FindAllComponents()
        {
            #region Canvas
            var canvasGameObject = gameObject.GetComponentInChildren <Canvas>()?.gameObject;

            if (canvasGameObject == null)
            {
                QuickLogger.Error("Canvas cannot be found");
                return(false);
            }
            #endregion

            #region Home

            var home = canvasGameObject.FindChild("Home")?.gameObject;

            if (home == null)
            {
                QuickLogger.Error("Unable to find Home GameObject");
                return(false);
            }
            #endregion

            #region Settings

            var settings = canvasGameObject.FindChild("Settings")?.gameObject;

            if (settings == null)
            {
                QuickLogger.Error("Unable to find Settings GameObject");
                return(false);
            }
            #endregion

            #region ColorPicker

            var colorPicker = canvasGameObject.FindChild("ColorPicker")?.gameObject;

            if (colorPicker == null)
            {
                QuickLogger.Error("Unable to find colorPicker GameObject");
                return(false);
            }
            #endregion

            #region Doors
            var doorsResult = InterfaceHelpers.FindGameObject(canvasGameObject, "Doors", out var doorsOutput);

            if (!doorsResult)
            {
                return(false);
            }

            var doors = doorsOutput;
            #endregion

            #region Start Button
            var startButtonResult = InterfaceHelpers.CreateButton(home, "Button", "startBTN", InterfaceButtonMode.Background,
                                                                  _startColor, _hoverColor, OnButtonClick, out var startButton);
            startButton.TextLineOne = "Start Cooking";

            if (!startButtonResult)
            {
                return(false);
            }
            _startButton = startButton;
            #endregion

            #region Color Picker
            var colorPickerResult = InterfaceHelpers.CreateButton(settings, "Paint_BTN", "colorPickerBTN", InterfaceButtonMode.Background,
                                                                  OnButtonClick, out var colorPickerButton);
            colorPickerButton.TextLineOne = "Color Picker Page";

            if (!colorPickerResult)
            {
                return(false);
            }
            #endregion

            #region Settings BTN
            var settingsResult = InterfaceHelpers.CreateButton(home, "Settings", "settingsBTN", InterfaceButtonMode.Background,
                                                               OnButtonClick, out var settingsButton);
            settingsButton.TextLineOne = SeaCookerBuildable.GoToSettingsPage();

            if (!settingsResult)
            {
                return(false);
            }
            #endregion

            #region Settings Color BTN
            var settingsCResult = InterfaceHelpers.CreateButton(colorPicker, "Home_BTN", "settingsBTN", InterfaceButtonMode.TextColor,
                                                                OnButtonClick, out var settings_C_BTN);
            settings_C_BTN.ChangeText($"< {SeaCookerBuildable.SettingsPage()}");
            settings_C_BTN.TextLineOne = $"{SeaCookerBuildable.GoToSettingsPage()}";

            if (!settingsCResult)
            {
                QuickLogger.Error($"Can't find settingsBTN");
                return(false);
            }
            #endregion

            #region Open Input BTN
            var openInputBTN = InterfaceHelpers.CreateButton(doors, "Open_Input", "openInputBTN", InterfaceButtonMode.TextColor,
                                                             OnButtonClick, out var openInputButton);
            openInputButton.TextLineOne = "Open Input Container";

            if (!openInputBTN)
            {
                return(false);
            }
            #endregion

            #region Open Export BTN
            var openExportBTN = InterfaceHelpers.CreateButton(doors, "Open_Export", "openExportBTN", InterfaceButtonMode.TextColor,
                                                              OnButtonClick, out var openExportButton);
            openExportButton.TextLineOne = "Open Export Container";

            if (!openExportBTN)
            {
                return(false);
            }
            #endregion

            #region Next BTN
            var nextBTN = InterfaceHelpers.CreatePaginator(colorPicker, "NextPage", 1, _colorPage.ChangeColorPageBy, out var nextButton);
            nextButton.TextLineOne = "Next Page";

            if (!nextBTN)
            {
                return(false);
            }
            #endregion

            #region Prev BTN
            var prevBTN = InterfaceHelpers.CreatePaginator(colorPicker, "PrevPage", -1, _colorPage.ChangeColorPageBy, out var prevButton);
            prevButton.TextLineOne = "Previous Page";

            if (!prevBTN)
            {
                return(false);
            }
            #endregion

            #region Color Grid
            var colorGridResult = InterfaceHelpers.FindGameObject(colorPicker, "Grid", out var colorGrid);

            if (!colorGridResult)
            {
                return(false);
            }
            _colorGrid = colorGrid;
            #endregion

            #region SeaBreeze Grid
            var seaBreezeGridResult = InterfaceHelpers.FindGameObject(settings, "Grid", out var seaBreezeGrid);

            if (!seaBreezeGridResult)
            {
                return(false);
            }

            _seaBreezeGrid.Setup(4, SeaCookerBuildable.SeaBreezeItemPrefab, settings, Color.white, new Color(0.07f, 0.38f, 0.7f, 1f), OnButtonClick);
            _seaBreezeGrid.OnLoadDisplay += OnLoadDisplay;
            #endregion

            #region From Image OMIT
            //var fromImage = InterfaceHelpers.FindGameObject(home, "from_Image", out var from_Image);

            //if (!fromImage)
            //{
            //    return false;
            //}
            //_fromImage = from_Image;
            //uGUI_Icon fromIcon = _fromImage.gameObject.AddComponent<uGUI_Icon>();
            #endregion

            #region To Image OMIT
            var toImage = InterfaceHelpers.FindGameObject(home, "to_Image", out var to_Image);

            if (!toImage)
            {
                return(false);
            }
            _toImage = to_Image;
            uGUI_Icon toIcon = _toImage.gameObject.AddComponent <uGUI_Icon>();
            #endregion

            #region Percentage Bar
            var percentageResult = InterfaceHelpers.FindGameObject(home, "Preloader_Bar", out var percentage);

            if (!percentageResult)
            {
                return(false);
            }
            _percentage = percentage.GetComponent <Image>();
            #endregion

            #region Version
            var versionResult = InterfaceHelpers.FindGameObject(canvasGameObject, "Version", out var version);

            if (!versionResult)
            {
                return(false);
            }
            var versionLbl = version.GetComponent <Text>();
            versionLbl.text = $"{SeaCookerBuildable.Version()}: {QPatch.Version}";
            #endregion

            #region Paginator
            var paginatorResult = InterfaceHelpers.FindGameObject(colorPicker, "Paginator", out var paginator);

            if (!paginatorResult)
            {
                return(false);
            }
            _paginator = paginator.GetComponent <Text>();
            #endregion

            #region Seabreeze Toggle
            var toggleResult = InterfaceHelpers.FindGameObject(settings, "Toggle_SB_Export", out var toggle);

            if (!toggleResult)
            {
                QuickLogger.Error($"Cannot find Toggle_SB_Export on GameObject");
                return(false);
            }

            _cusToggle               = toggle.AddComponent <CustomToggle>();
            _cusToggle.BtnName       = "seaBreezeToggle";
            _cusToggle.ButtonMode    = InterfaceButtonMode.Background;
            _cusToggle.OnButtonClick = OnButtonClick;
            _cusToggle.Tag           = _cusToggle;
            #endregion

            #region Auto Toggle
            var autoResult = InterfaceHelpers.FindGameObject(settings, "Auto_Toggle", out var autoToggle);

            if (!autoResult)
            {
                QuickLogger.Error($"Cannot find Auto_Toggle on GameObject");
                return(false);
            }

            _autoToggle               = autoToggle.AddComponent <CustomToggle>();
            _autoToggle.BtnName       = "autoToggle";
            _autoToggle.ButtonMode    = InterfaceButtonMode.Background;
            _autoToggle.OnButtonClick = OnButtonClick;
            _autoToggle.Tag           = _autoToggle;
            #endregion

            return(true);
        }
예제 #12
0
 //
 void Awake()
 {
     _toggle = GetComponent <CustomToggle>();
 }
 public void addToggle(CustomToggle toggle)
 {
     list.Add(toggle);
 }