Exemplo n.º 1
0
        public static GameObject Add(string name, string tooltip, byte[] png, Action <GameObject> action)
        {
            GameObject _Base  = _SysShortcut.transform.Find("Base").gameObject;
            GameObject _Grid  = _Base.transform.Find("Grid").gameObject;
            GameObject button = NGUITools.AddChild(_Grid, UTY.GetChildObject(_Grid, "Config", true));

            button.name = name;
            EventDelegate.Set(button.GetComponent <UIButton>().onClick, () => { action(button); });
            UIEventTrigger trigger = button.GetComponent <UIEventTrigger>();

            EventDelegate.Set(trigger.onHoverOver, () => { VisibleExplanationRaw(tooltip); });
            EventDelegate.Set(trigger.onHoverOut, () => { _SysShortcut.VisibleExplanation(null, false); });
            EventDelegate.Set(trigger.onDragStart, () => { _SysShortcut.VisibleExplanation(null, false); });
            UISprite sprite = button.GetComponent <UISprite>();

            sprite.type       = UIBasicSprite.Type.Filled;
            sprite.fillAmount = 0.0f;
            Texture2D texture = new Texture2D(1, 1);

            texture.LoadImage(png);
            UITexture uitexture = NGUITools.AddWidget <UITexture>(button);

            uitexture.material             = new Material(uitexture.shader);
            uitexture.material.mainTexture = texture;
            uitexture.MakePixelPerfect();
            repositionButtons();
            return(button);
        }
Exemplo n.º 2
0
        // Token: 0x06000006 RID: 6 RVA: 0x000020F8 File Offset: 0x000002F8
        public static GameObject Add(string name, string label, byte[] pngData, Action <GameObject> action)
        {
            GameObject goButton = null;

            if (Buttons.Contains(name))
            {
                Buttons.Remove(name);
            }
            if (action == null)
            {
                return(goButton);
            }
            try
            {
                goButton = NGUITools.AddChild(Buttons.Grid, UTY.GetChildObject(Buttons.Grid, "Config", true));
                if (name != null)
                {
                    goButton.name = name;
                }
                EventDelegate.Set(goButton.GetComponent <UIButton>().onClick, delegate()
                {
                    action(goButton);
                });
                UIEventTrigger component = goButton.GetComponent <UIEventTrigger>();
                EventDelegate.Add(component.onHoverOut, delegate()
                {
                    Buttons.SysShortcut.VisibleExplanation(null, false);
                });
                EventDelegate.Add(component.onDragStart, delegate()
                {
                    Buttons.SysShortcut.VisibleExplanation(null, false);
                });
                Buttons.SetText(goButton, label);
                if (pngData == null)
                {
                    pngData = DefaultIcon.Png;
                }
                UISprite component2 = goButton.GetComponent <UISprite>();
                component2.type       = UIBasicSprite.Type.Filled;
                component2.fillAmount = 0f;
                Texture2D texture2D = new Texture2D(1, 1);
                texture2D.LoadImage(pngData);
                UITexture uitexture = NGUITools.AddWidget <UITexture>(goButton);
                uitexture.material             = new Material(uitexture.shader);
                uitexture.material.mainTexture = texture2D;
                uitexture.MakePixelPerfect();
                Buttons.Reposition();
            }
            catch
            {
                if (goButton != null)
                {
                    NGUITools.Destroy(goButton);
                    goButton = null;
                }
                throw;
            }
            return(goButton);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="__instance"></param>
 /// <param name="test"></param>
 private static void SetMethod(SceneFreeModeSelectManager __instance, string test)
 {
     MyLog.LogMessage("CreateItemEverydayList:" + test);
     try
     {
         GameObject childObject = UTY.GetChildObject(__instance.gameObject.transform.parent.gameObject, test, false);
         childObject.SetActive(true);
         childObject.GetComponent <UIButton>().isEnabled = true;
     }
     catch (Exception)
     {
         MyLog.LogError("CreateItemEverydayList:" + test);
     }
 }
Exemplo n.º 4
0
        public static void OnSceneFreeModeSelectAwake(SceneFreeModeSelectManager mgr)
        {
            if (!EnableAllFreeModeItems)
            {
                return;
            }

            var root      = mgr.gameObject.transform.parent.gameObject;
            var buttonObj = UTY.GetChildObject(root, "MenuSelect/Menu/FreeModeMenuButton/夜伽");

            buttonObj.SetActive(true);
            var button = buttonObj.GetComponent <UIButton>();

            button.isEnabled = true;
        }
Exemplo n.º 5
0
        public static void LocalizeNTRScene(GameObject ___toggleParent)
        {
            Core.Logger.LogInfo("Fixing NTR check scene.");

            void Localize(string item)
            {
                var result = UTY.GetChildObject(___toggleParent, $"{item}/Result"); //.GetComponent<UILabel>();
                var title  = UTY.GetChildObject(___toggleParent, $"{item}/Title");  //.GetComponent<UILabel>();

                var resultLoc = result.AddComponent <Localize>();

                resultLoc.SetTerm($"SceneNetorareCheck/{item}_Result");

                var titleLoc = title.AddComponent <Localize>();

                titleLoc.SetTerm($"SceneNetorareCheck/{item}_Title");
            }

            Localize("Toggle_LockUserDraftMaid");
            Localize("Toggle_IsComPlayer");
        }
Exemplo n.º 6
0
        public void Call(Maid maid, ScheduleMgr.ScheduleTime scheduleTime, Dictionary <ScheduleTaskCtrl.TaskType, List <ScheduleTaskViewer.ViewData> > viewDic, Dictionary <ScheduleMgr.ScheduleTime, ScheduleCSVData.ScheduleBase> currentSetWorkDic)
        {
            if (this.category_button_dic_ == null)
            {
                this.Awake();
            }
            ScheduleTaskViewer.scheduleTime = scheduleTime;
            HashSet <int> hashSet        = new HashSet <int>();
            int           maxValue       = int.MaxValue;
            UIWFTabButton uiwftabButton  = null;
            UIWFTabButton uiwftabButton2 = null;

            foreach (KeyValuePair <ScheduleTaskCtrl.TaskType, List <ScheduleTaskViewer.ViewData> > keyValuePair in viewDic)
            {
                this.CallEnableButton(maid, keyValuePair.Key, keyValuePair.Value, ref hashSet, ref maxValue);
            }
            this.currentWorkDic = currentSetWorkDic;
            int num = maxValue;

            ScheduleCSVData.ScheduleBase work_data = null;
            foreach (KeyValuePair <int, UIButton> keyValuePair2 in this.category_button_dic_)
            {
                keyValuePair2.Value.onClick.Clear();
                bool flag = hashSet.Contains(keyValuePair2.Key);
                keyValuePair2.Value.transform.parent.gameObject.SetActive(flag);
                if (flag)
                {
                    EventDelegate.Add(keyValuePair2.Value.onClick, new EventDelegate.Callback(this.OnClickFromMainCategoryButton));
                    if (uiwftabButton2 == null && num == keyValuePair2.Key)
                    {
                        uiwftabButton2 = keyValuePair2.Value.gameObject.GetComponent <UIWFTabButton>();
                    }
                    ScheduleCSVData.ScheduleBase scheduleBase = currentSetWorkDic[scheduleTime];
                    if (uiwftabButton == null && scheduleBase != null && scheduleBase.categoryID == keyValuePair2.Key)
                    {
                        work_data     = scheduleBase;
                        uiwftabButton = keyValuePair2.Value.gameObject.GetComponent <UIWFTabButton>();
                    }
                }
            }
            if (uiwftabButton == null)
            {
                uiwftabButton = uiwftabButton2;
            }
            Utility.ResetNGUI(this.CategoryGrid);
            Utility.ResetNGUI(this.CategoryScrollView);
            UIWFTabPanel componentInChildren = this.CategoryGrid.GetComponentInChildren <UIWFTabPanel>();

            componentInChildren.ResetSelect();
            componentInChildren.UpdateChildren();
            if (uiwftabButton != null)
            {
                componentInChildren.Select(uiwftabButton);
            }
            if (this.descDic == null)
            {
                DescScheduleYotogi component = UTY.GetChildObject(base.gameObject, "DescScheduleYotogi", false).GetComponent <DescScheduleYotogi>();
                component.Init(this.taskCtrl);
                DescScheduleTraining component2 = UTY.GetChildObject(base.gameObject, "DescScheduleTraining", false).GetComponent <DescScheduleTraining>();
                component2.Init(this.taskCtrl);
                DescScheduleWork component3 = UTY.GetChildObject(base.gameObject, "DescScheduleWork", false).GetComponent <DescScheduleWork>();
                component3.Init(this.taskCtrl);
                this.descDic = new Dictionary <ScheduleTaskCtrl.TaskType, DescScheduleBase>();
                this.descDic.Add(ScheduleTaskCtrl.TaskType.Yotogi, component);
                this.descDic.Add(ScheduleTaskCtrl.TaskType.Training, component2);
                this.descDic.Add(ScheduleTaskCtrl.TaskType.Work, component3);
            }
            this.UpdateForDescriptionViewer(work_data);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 歯車メニューにボタンを追加
        /// </summary>
        /// <param name="name">ボタンオブジェクト名。null可</param>
        /// <param name="label">ツールチップテキスト。null可(ツールチップ非表示)。アイコンへのマウスオーバー時に表示される</param>
        /// <param name="pngData">アイコン画像。null可(システムアイコン使用)。32x32ピクセルのPNGファイル</param>
        /// <param name="action">コールバック。null可(コールバック削除)。アイコンクリック時に呼び出されるコールバック</param>
        /// <returns>生成されたボタンのGameObject</returns>
        /// <example>
        /// ボタン追加例
        /// <code>
        /// public class MyPlugin : UnityInjector.PluginBase {
        ///     void Awake() {
        ///         GearMenu.Buttons.Add(GetType().Name, "テスト", null, GearMenuCallback);
        ///     }
        ///     void GearMenuCallback(GameObject goButton) {
        ///         Debug.LogWarning("GearMenuCallback呼び出し");
        ///     }
        /// }
        /// </code>
        /// </example>
        public static GameObject Add(string name, string label, byte[] pngData, Action <GameObject> action)
        {
            GameObject goButton = null;

            // 既に存在する場合は削除して続行
            if (Contains(name))
            {
                Remove(name);
            }

            if (action == null)
            {
                return(goButton);
            }

            try
            {
                // ギアメニューの子として、コンフィグパネル呼び出しボタンを複製
                goButton = NGUITools.AddChild(Grid, UTY.GetChildObject(Grid, "Config", true));

                // 名前を設定
                if (name != null)
                {
                    goButton.name = name;
                }

                // イベントハンドラ設定(同時に、元から持っていたハンドラは削除)
                EventDelegate.Set(goButton.GetComponent <UIButton>().onClick, () => { action(goButton); });

                // ポップアップテキストを追加
                {
                    UIEventTrigger t = goButton.GetComponent <UIEventTrigger>();
                    EventDelegate.Add(t.onHoverOut, () => { SysShortcut.VisibleExplanation(null, false); });
                    EventDelegate.Add(t.onDragStart, () => { SysShortcut.VisibleExplanation(null, false); });
                    SetText(goButton, label);
                }

                // PNG イメージを設定
                {
                    if (pngData == null)
                    {
                        pngData = DefaultIcon.Png;
                    }

                    // 本当はスプライトを削除したいが、削除するとパネルのα値とのTween同期が動作しない
                    // (動作させる方法が分からない) ので、スプライトを描画しないように設定する
                    // もともと持っていたスプライトを削除する場合は以下のコードを使うと良い
                    //     NGUITools.Destroy(goButton.GetComponent<UISprite>());
                    UISprite us = goButton.GetComponent <UISprite>();
                    us.type       = UIBasicSprite.Type.Filled;
                    us.fillAmount = 0.0f;

                    // テクスチャを生成
                    var tex = new Texture2D(1, 1);
                    tex.LoadImage(pngData);

                    // 新しくテクスチャスプライトを追加
                    UITexture ut = NGUITools.AddWidget <UITexture>(goButton);
                    ut.material             = new Material(ut.shader);
                    ut.material.mainTexture = tex;
                    ut.MakePixelPerfect();
                }

                // グリッド内のボタンを再配置
                Reposition();
            }
            catch
            {
                // 既にオブジェクトを作っていた場合は削除
                if (goButton != null)
                {
                    NGUITools.Destroy(goButton);
                    goButton = null;
                }
                throw;
            }
            return(goButton);
        }
Exemplo n.º 8
0
        public unsafe static GameObject Add(string name, string label, byte[] pngData, Action <GameObject> action)
        {
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            //IL_0048: Unknown result type (might be due to invalid IL or missing references)
            //IL_004d: Expected O, but got Unknown
            //IL_0078: Unknown result type (might be due to invalid IL or missing references)
            //IL_007d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0094: Unknown result type (might be due to invalid IL or missing references)
            //IL_0099: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
            //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
            //IL_00be: Unknown result type (might be due to invalid IL or missing references)
            //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
            //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
            //IL_0117: Unknown result type (might be due to invalid IL or missing references)
            //IL_011c: Expected O, but got Unknown
            //IL_0132: Unknown result type (might be due to invalid IL or missing references)
            //IL_0137: Unknown result type (might be due to invalid IL or missing references)
            //IL_0142: Unknown result type (might be due to invalid IL or missing references)
            GameObject goButton = null;

            if (Contains(name))
            {
                Remove(name);
            }
            if (action == null)
            {
                return(goButton);
            }
            try
            {
                goButton = NGUITools.AddChild(Grid, UTY.GetChildObject(Grid, "Config", true));
                if (name != null)
                {
                    goButton.name = name;
                }
                EventDelegate.Set(goButton.GetComponent <UIButton>().onClick, () => { action(goButton); });
                UIEventTrigger component = goButton.GetComponent <UIEventTrigger>();
                EventDelegate.Add(component.onHoverOut, () => { SysShortcut.VisibleExplanation(null, false); });
                EventDelegate.Add(component.onDragStart, () => { SysShortcut.VisibleExplanation(null, false); });
                SetText(goButton, label);
                if (pngData == null)
                {
                    pngData = DefaultIcon.Png;
                }
                UISprite component2 = goButton.GetComponent <UISprite>();
                component2.type       = (UIBasicSprite.Type) 3;
                component2.fillAmount = 0f;
                Texture2D val3 = new Texture2D(1, 1);
                val3.LoadImage(pngData);
                UITexture obj = NGUITools.AddWidget <UITexture>(goButton);
                obj.material             = new Material(obj.shader);
                obj.material.mainTexture = val3;
                obj.MakePixelPerfect();
                Reposition();
            }
            catch
            {
                if (goButton != null)
                {
                    NGUITools.Destroy(goButton);
                    goButton = null;
                }
                throw;
            }
            return(goButton);
        }
Exemplo n.º 9
0
 private void SetUIEnabled(bool enable)
 {
     UTY.GetChildObject(this.windowMgr.gameObject, "WindowVisibleBtnsParent", false).SetActive(enable);
     Base.SetActive(enable);
     Gear.SetActive(enable);
 }