示例#1
0
            private static void SetupButton(string name, int offset, KinematicsType kinematicsType, ButtonType buttonType, int index)
            {
                Button btn = Instantiate(GetPanelObject <Button>("Button For Anime (2)"), FKIKPanel.transform);

                btn.name = name;
                btn.transform.localPosition = new Vector3(btn.transform.localPosition.x, PositionBase + (PositionOffset * offset), btn.transform.localPosition.z);

                string fieldname1 = kinematicsType == KinematicsType.FK ? "fkInfo" : "ikInfo";
                string fieldname2 = buttonType == ButtonType.Anime ? "buttonAnimeSingle" : "buttonInitSingle";

                btn.onClick.RemoveAllListeners();
                btn.onClick.AddListener(delegate() { Traverse.Create(FindObjectOfType <MPCharCtrl>()).Field(fieldname1).Field(fieldname2).GetValue <Button[]>()[index].onClick.Invoke(); });
            }
示例#2
0
            private static void SetupToggle(string name, int offset, KinematicsType kinematicsType, string referenceField)
            {
                Toggle tglOriginal = GetPanelObject <Toggle>("Toggle Neck");
                Toggle tgl         = Instantiate(tglOriginal, FKIKPanel.transform);

                tgl.name = name;
                tgl.transform.localPosition = new Vector3(tgl.transform.localPosition.x, PositionBase + (PositionOffset * offset), tgl.transform.localPosition.z);

                string fieldname = kinematicsType == KinematicsType.FK ? "fkInfo" : "ikInfo";
                Toggle tglRef    = Traverse.Create(FindObjectOfType <MPCharCtrl>()).Field(fieldname).Field(referenceField).GetValue <Toggle>();

                tgl.onValueChanged.RemoveAllListeners();
                tgl.isOn = tglRef.isOn;
                tgl.onValueChanged.AddListener(delegate(bool value) { tglRef.onValueChanged.Invoke(value); });
                tglRef.onValueChanged.AddListener(delegate(bool value) { tgl.isOn = value; });
            }