コード例 #1
0
ファイル: HotReloader.cs プロジェクト: Flowaria/DataDumper
        void Awake()
        {
            Rundown      = FindObjectOfType <CM_PageRundown_New>();
            ReloadButton = Instantiate(Rundown.m_discordButton.gameObject);
            ReloadButton = Instantiate(Rundown.m_discordButton.gameObject);
            ReloadButton.gameObject.SetActive(true);


            ReloadButton.gameObject.transform.position = Rundown.m_discordButton.gameObject.transform.position;
            ReloadButton.gameObject.transform.parent   = Rundown.m_discordButton.gameObject.transform;
            RectTransform rect = ReloadButton.gameObject.GetComponent <RectTransform>();

            rect.transform.position += new Vector3(0, 100, 0);
            CM_Item Button = ReloadButton.GetComponent <CM_Item>();

            Button.SetText("Reload Game Data");

            Button.add_OnBtnPressCallback((Action <int>)((_) =>
            {
                ReloadData();
            }));

            RectTransform transform = ReloadButton.GetComponent <RectTransform>();
            var           aPos      = transform.position;

            aPos.y            += 10;
            transform.position = aPos;
        }
コード例 #2
0
ファイル: HotReloader.cs プロジェクト: notpeelz/MTFO
        public void Update()
        {
            //this is the worst code ive ever written but it kept breaking when i did it otherways, please someone fix this
            if (Rundown == null)
            {
                Rundown = FindObjectOfType <CM_PageRundown_New>();
                return;
            }
            else
            {
                if (ReloadButton == null)
                {
                    ReloadButton = Instantiate(Rundown.m_discordButton.gameObject);
                    ReloadButton.gameObject.SetActive(true);


                    ReloadButton.gameObject.transform.position = Rundown.m_discordButton.gameObject.transform.position;
                    ReloadButton.gameObject.transform.parent   = Rundown.m_discordButton.gameObject.transform;
                    RectTransform rect = ReloadButton.gameObject.GetComponent <RectTransform>();
                    rect.transform.position += new Vector3(0, 100, 0);
                    CM_Item Button = ReloadButton.GetComponent <CM_Item>();

                    Button.SetText("Reload Game Data");

                    Button.add_OnBtnPressCallback((Action <int>)((number) =>
                    {
                        ReloadData();
                    }));

                    RectTransform transform = ReloadButton.GetComponent <RectTransform>();
                    var           aPos      = transform.position;
                    aPos.y            += 10;
                    transform.position = aPos;
                    return;
                }
            }
        }