Ejemplo n.º 1
0
 internal static void UpdateVirtualButtons(ImageTargetAbstractBehaviour it, ConfigData.VirtualButtonData[] vbs)
 {
     for (int i = 0; i < vbs.Length; i++)
     {
         VirtualButtonAbstractBehaviour[] componentsInChildren = it.GetComponentsInChildren <VirtualButtonAbstractBehaviour>();
         bool flag = false;
         for (int j = 0; j < componentsInChildren.Length; j++)
         {
             if (componentsInChildren[j].VirtualButtonName == vbs[i].name)
             {
                 SerializedObject serializedObject = new SerializedObject(componentsInChildren[j]);
                 using (serializedObject.Edit())
                 {
                     componentsInChildren[j].enabled = vbs[i].enabled;
                     VirtualButtonEditor.GetSensitivityProperty(serializedObject).enumValueIndex = (int)vbs[i].sensitivity;
                     componentsInChildren[j].SetPosAndScaleFromButtonArea(new Vector2(vbs[i].rectangle[0], vbs[i].rectangle[1]), new Vector2(vbs[i].rectangle[2], vbs[i].rectangle[3]));
                 }
                 flag = true;
             }
         }
         if (!flag)
         {
             VirtualButtonEditor.AddVirtualButton(it, vbs[i]);
         }
     }
 }
Ejemplo n.º 2
0
        public void OnEnable()
        {
            VirtualButtonAbstractBehaviour arg_2D_0 = (VirtualButtonAbstractBehaviour)base.target;

            this.mName        = VirtualButtonEditor.GetNameProperty(base.serializedObject);
            this.mSensitivity = VirtualButtonEditor.GetSensitivityProperty(base.serializedObject);
            VirtualButtonEditor.EditorConfigureTarget(arg_2D_0);
        }
Ejemplo n.º 3
0
        private static void AddVirtualButton(ImageTargetAbstractBehaviour it, ConfigData.VirtualButtonData vb)
        {
            VirtualButtonAbstractBehaviour virtualButtonAbstractBehaviour = it.CreateVirtualButton(vb.name, new Vector2(0f, 0f), new Vector2(1f, 1f));

            if (virtualButtonAbstractBehaviour != null)
            {
                SerializedObject serializedObject = new SerializedObject(virtualButtonAbstractBehaviour);
                using (serializedObject.Edit())
                {
                    VirtualButtonEditor.GetSensitivityProperty(serializedObject).enumValueIndex = (int)vb.sensitivity;
                }
                virtualButtonAbstractBehaviour.SetPosAndScaleFromButtonArea(new Vector2(vb.rectangle[0], vb.rectangle[1]), new Vector2(vb.rectangle[2], vb.rectangle[3]));
                VirtualButtonEditor.CreateVBMesh(virtualButtonAbstractBehaviour.gameObject);
                VirtualButtonEditor.CreateMaterial(virtualButtonAbstractBehaviour.gameObject);
                virtualButtonAbstractBehaviour.enabled = vb.enabled;
                BehaviourComponentFactory.Instance.AddTurnOffBehaviour(virtualButtonAbstractBehaviour.gameObject);
                virtualButtonAbstractBehaviour.UpdatePose();
                return;
            }
            Debug.LogError("VirtualButton could not be added!");
        }