コード例 #1
0
ファイル: Main.cs プロジェクト: aedenthorn/mytimeatportia
            static void Postfix(TVBenchUnitViewer __instance, GameObject ___placeHolder, ref TVCtr ___tVCtr)
            {
                if (!enabled || __instance.GetComponentInParent <PhotoFrameCtr>() == null)
                {
                    return;
                }
                Dbgl($"Fresh Items");
                ItemObject item     = ItemObject.CreateItem(4030001);
                GameObject tvObject = GameUtils.AddChild(___placeHolder, item.ItemBase.DropModelPath, false, AssetType.ItemSystem);

                MeshRenderer[] tvms = tvObject.GetComponentsInChildren <MeshRenderer>();

                for (int i = 0; i < tvms.Length; i++)
                {
                    MeshRenderer m = tvms[i];
                    m.gameObject.SetActive(false);
                }

                ___tVCtr = tvObject.GetComponentInChildren <TVCtr>(true);
                AudioSource audioSource = typeof(TVCtr).GetField("audioSource", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as AudioSource;

                audioSource.spatialBlend = settings.Spatiality;
                audioSource.volume       = 1f;
                typeof(TVCtr).GetField("audioSource", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(___tVCtr, audioSource);
                //VideoPlayer videoPlayer = typeof(TVCtr).GetField("videoPlayer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as VideoPlayer;
                //typeof(TVCtr).GetField("videoPlayer", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(___tVCtr, videoPlayer);
                GameObject newObj = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_ADBoard");

                GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as GameObject;

                MeshRenderer[] bbms = newObj.GetComponentsInChildren <MeshRenderer>();

                foreach (MeshRenderer m in bbms)
                {
                    //Dbgl($"mesh: {m.name}");
                    if (m.name == "Item_Billboard_2")
                    {
                        screen.GetComponentInChildren <MeshFilter>().mesh        = m.GetComponentInChildren <MeshFilter>().mesh;
                        screen.GetComponentInChildren <MeshRenderer>().materials = m.materials;
                        //screen.GetComponentInChildren<Transform>().position = m.gameObject.GetComponentInChildren<Transform>().position;
                        break;
                    }
                }

                /*
                 * Component[] components = screen.GetComponents(typeof(Component));
                 * foreach (Component component in components)
                 * {
                 *  Dbgl($"component: {component.ToString()}");
                 * }
                 */
                //Vector3 scale = screen.GetComponentInChildren<MeshFilter>().transform.localScale;
                //screen.GetComponentInChildren<MeshFilter>().transform.localScale = new Vector3(scale.x, 1.6f, scale.z);
                //Dbgl($"local scale: {screen.transform.localScale}");
                //screen.GetComponentInChildren<VideoPlayer>().aspectRatio = VideoAspectRatio.NoScaling;
                Vector3 pos = screen.GetComponentInChildren <MeshFilter>().transform.position;

                screen.transform.position = new Vector3(pos.x, pos.y - 0.84f, pos.z) - screen.GetComponentInChildren <MeshFilter>().transform.forward * 0.02f;
            }
コード例 #2
0
    private void CreatBtn()
    {
        HelpBtnItem ob;
        HelpConfig  conData;

        for (int i = 0; i < list.Count; i++)
        {
            conData = list[i] as HelpConfig;
            ob      = GameUtils.AddChild <HelpBtnItem>(mBtnItem, mBtnGrid.transform);
            ob.gameObject.SetActive(true);
            ob.InitiaData(conData.index, conData.btnName);
        }
        mBtnGrid.Reposition();
    }
コード例 #3
0
        void ShowDupWindow(ItemObject item, Action <int> confirm)
        {
            try {
                if (_dupWindow is null)
                {
                    _dupWindow = GameUtils.AddChild(gameObject, Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.UiSystem, "Prefabs/ItemSplit"), false, true);
                }

                _dupWindow.GetComponent <PackageItemDelete>().Show(confirm, null, 999, item, () => {
                    _inDupMode = false;
                });
            } catch (Exception ex) {
                Main.Logger.LogException(ex);
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: aedenthorn/mytimeatportia
            static void Postfix(PhotoFrameCtr __instance)
            {
                if (!enabled)
                {
                    return;
                }
                Dbgl($"starting photoframectr");

                MeshRenderer[] bbms = __instance.gameObject.GetComponentsInChildren <MeshRenderer>();

                MeshRenderer screenMr = null;

                foreach (MeshRenderer m in bbms)
                {
                    //Dbgl($"mesh: {m.name}");
                    if (m.name == "Item_Billboard_2")
                    {
                        screenMr = m;
                        break;
                    }
                }

                if (screenMr == null)
                {
                    return;
                }

                GameObject tvt = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_TVTable");

                TVBenchUnitViewer tvtv = tvt.GetComponentInChildren <TVBenchUnitViewer>(true);

                /*
                 * CabinetUnit unit = new CabinetUnit(3031001);
                 * unit.PutCabinet(4030001, 1, out ItemObject item);
                 * typeof(TVBenchUnitViewer).GetMethod("SetUnitInternal", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(tvtv, new object[] { unit });
                 * Dbgl($"Set Unit");
                 */

                GameObject tvtr = UnityEngine.Object.Instantiate(tvt, __instance.gameObject.transform);
                //Dbgl($"Instantiated");


                ItemObject item = ItemObject.CreateItem(4030001);

                //Dbgl($"got item {item.ItemBase.Name}");

                GameUtils.ClearChildren(typeof(TVBenchUnitViewer).GetField("placeHolder", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvtv) as GameObject, false);
                GameObject tvObject = GameUtils.AddChild(typeof(TVBenchUnitViewer).GetField("placeHolder", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvtv) as GameObject, item.ItemBase.DropModelPath, false, AssetType.ItemSystem);
                TVCtr      tvc      = tvObject.GetComponentInChildren <TVCtr>(true);

                //Dbgl($"tvc is null? {tvc == null}");

                typeof(TVBenchUnitViewer).GetField("tVCtr", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(tvtv, tvc);

                MeshRenderer[] tvtms = tvtr.GetComponentsInChildren <MeshRenderer>();

                for (int i = 0; i < tvtms.Length; i++)
                {
                    MeshRenderer m = tvtms[i];
                    m.gameObject.SetActive(false);
                }

                MeshRenderer[] tvms = tvObject.GetComponentsInChildren <MeshRenderer>();

                for (int i = 0; i < tvms.Length; i++)
                {
                    MeshRenderer m = tvms[i];
                    m.gameObject.SetActive(false);
                }

                GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvc) as GameObject;

                screen.GetComponentInChildren <MeshFilter>().mesh = screenMr.GetComponentInChildren <MeshFilter>().mesh;

                //screen.transform.localScale = new Vector3(32f, 18f, 1f);

                PlayerTargetMultiAction CurPlayerTarget = (PlayerTargetMultiAction)typeof(UnitViewer).GetProperty("CurPlayerTarget", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance, null);

                CurPlayerTarget.SetAction(ActionType.ActionRoll, 103809, ActionTriggerMode.Normal);
            }