private void autoSectionButton_Click(object sender, EventArgs e)
        {
            frm_AutoSection autoSectionView = new frm_AutoSection();

            autoSectionView.Owner         = this;
            autoSectionView.StartPosition = FormStartPosition.CenterParent;
            if (autoSectionView.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (autoSectionView.AutoSectionParam != null)
                {
                    List <DisplayAutoBrightMapping> mappingList;
                    if (CustomTransform.FastSegment(autoSectionView.AutoSectionParam, out mappingList))
                    {
                        brightnessDataGridView.Rows.Clear();
                        foreach (var item in mappingList)
                        {
                            object[] row = { item.EnvironmentBright, item.DisplayBright };
                            brightnessDataGridView.Rows.Add(row);
                            var mappingItem = new BrightnessMapping();
                            mappingItem.EnvironmentBrightness = item.EnvironmentBright;
                            mappingItem.LedBrightness         = item.DisplayBright;
                            _brightnessMappingTable.Add(mappingItem);
                        }
                    }
                }
            }
            brightnessDataGridView_Validated(sender, e);
        }
Ejemplo n.º 2
0
    public void LoadReplayData()
    {
        string filePath = LoggingManager.GetPath("replayData.csv");

        System.IO.FileInfo file = new System.IO.FileInfo(filePath);
        using (var reader = new StreamReader(filePath))
        {
            frameData = new List <CustomTransform>();
            string line       = reader.ReadLine();
            int    frameCount = -1;
            while (line != null && line.Length != 0)
            {
                string[] splitArray = line.Split(',');
                Vector3  position   = new Vector3(float.Parse(splitArray[1]), float.Parse(splitArray[2]), float.Parse(splitArray[3]));
                Vector3  rotation   = new Vector3(float.Parse(splitArray[4]), float.Parse(splitArray[5]), float.Parse(splitArray[6]));

                CustomTransform tr = new CustomTransform();
                if (int.Parse(splitArray[0]) == 0)
                {
                    frameCount++;
                }
                tr.index    = int.Parse(splitArray[0]);
                tr.position = position;
                tr.rotation = rotation;
                tr.frame    = frameCount;

                frameData.Add(tr);

                line = reader.ReadLine();
            }
        }
        StartReplay();
    }
    /// <summary>
    /// 更新子物体的位置和角度
    /// </summary>
    /// <param name="ctrans"></param>
    void UpdateTrans(CustomTransform ctrans)
    {
        Transform trans = ctrans.transform;
        //更新角度
        int angle = -(int)trans.transform.localEulerAngles.y;

        angle -= angle / 360 * 360;
        if (angle < -180)
        {
            angle += 360;
        }
        if (angle > 180)
        {
            angle -= 360;
        }
        if (ctrans.LocalAngle != angle)
        {
            ctrans.LocalAngle = angle;
        }
        //更新位置
        CustomVector3 vec = CustomVector3.GetCustomVector3ByVector3(trans.localPosition);

        if (ctrans.LocalPosition != vec)
        {
            ctrans.LocalPosition = vec;
        }
    }
Ejemplo n.º 4
0
    public override void OnInspectorGUI()
    {
        CustomTransform customTarget = (CustomTransform)target;

        {
            EditorGUILayout.BeginHorizontal();
            GUI.color = Color.yellow;
            if (GUILayout.Button("click " + customTarget.GetInstanceID(), GUILayout.Width(200)))
            {
                Debug.Log("gui lay out button click");
            }
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Target: " + customTarget.gameObject.name);
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.Separator();
        {
            GUI.color = Color.cyan;
            EditorGUILayout.BeginVertical();
            {
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                EditorGUILayout.LabelField("InstanceID(int)", GUILayout.Width(100)); EditorGUILayout.Separator();
                EditorGUILayout.TextField(customTarget.GetInstanceID().ToString());
                EditorGUILayout.EndHorizontal();
            }
            {
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                EditorGUILayout.LabelField("InstanceID(uint)", GUILayout.Width(100)); EditorGUILayout.Separator();
                EditorGUILayout.TextField(((uint)customTarget.GetInstanceID()).ToString());
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
        {
            GUI.color = Color.white;
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Target: " + customTarget.gameObject.name);
            EditorGUILayout.LabelField("Target: " + customTarget.gameObject.name);
            EditorGUILayout.LabelField("Target: " + customTarget.gameObject.name);
            EditorGUILayout.EndVertical();
        }

        {
            GUI.backgroundColor = Color.cyan;
            if (GUILayout.Button("SelectObject"))
            {
                Selection.activeGameObject = GameObject.Find("SelectObject");
            }
            if (GUILayout.Button("MessageBox_0"))
            {
                int result = MessageBox(IntPtr.Zero, "this is a message from ET", "Oh!!!!!!!!!!!!!!", 0);
                Debug.Log("messageBox result " + result);
            }
            if (GUILayout.Button("MessageBox_1"))
            {
                int result = MessageBox(IntPtr.Zero, "this is a message from ET", "Oh!!!!!!!!!!!!!!", 1);
                Debug.Log("messageBox result " + result);
            }
        }
    }
Ejemplo n.º 5
0
        public static string GetCustomMessage(Hashtable langHashTable, string messageKey, string messageDefault)
        {
            string msg = "";

            if (!CustomTransform.GetLanguageString(messageKey, langHashTable, out msg))
            {
                msg = messageDefault;
            }
            return(msg);
        }
Ejemplo n.º 6
0
        protected void ShowSending(string msgKey, string msgDefault, bool isDisplay)
        {
            string msg = string.Empty;

            if (!CustomTransform.GetLanguageString(msgKey, HsLangTable, out msg))
            {
                msg = msgDefault;
            }
            ShowProcessForm(msg, isDisplay);
        }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        CustomTransform trans = target as CustomTransform;

        //编辑器状态下,拖拽更新
        if (!Application.isPlaying)
        {
            trans.LocalPosition = CustomVector3.GetCustomVector3ByVector3(trans.transform.localPosition);
            UpdateChild(trans.transform);
        }

        EditorGUILayout.BeginVertical();

        GUILayoutOption style1 = GUILayout.Width(10);
        GUILayoutOption style2 = GUILayout.Width(80);
        GUILayoutOption style3 = GUILayout.Width(100);

        CustomVector3 localPosition = trans.LocalPosition;

        EditorGUILayout.LabelField("LocalPostion");
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("x", style1);
        EditorGUILayout.LabelField(localPosition.x.value.ToString(), style2);
        EditorGUILayout.LabelField("y", style1);
        EditorGUILayout.LabelField(localPosition.y.value.ToString(), style2);
        EditorGUILayout.LabelField("z", style1);
        EditorGUILayout.LabelField(localPosition.z.value.ToString(), style2);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("LocalAngle", style3);
        EditorGUILayout.LabelField(trans.LocalAngle.ToString(), style2);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.LabelField("Postion");

        EditorGUILayout.BeginHorizontal();
        CustomVector3 Position = trans.Position;

        EditorGUILayout.LabelField("x", style1);
        EditorGUILayout.LabelField(Position.x.value.ToString(), style2);
        EditorGUILayout.LabelField("y", style1);
        EditorGUILayout.LabelField(Position.y.value.ToString(), style2);
        EditorGUILayout.LabelField("z", style1);
        EditorGUILayout.LabelField(Position.z.value.ToString(), style2);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Angle", style3);
        EditorGUILayout.LabelField(trans.Angle.ToString(), style2);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.EndVertical();
    }
Ejemplo n.º 8
0
 private bool CheckEmailValid(string email, out string errMsg)
 {
     errMsg = "";
     if (!CustomTransform.CheckEmailValid(email))
     {
         errMsg = CommonUI.GetCustomMessage(_hashtable, "EmailAddrError", "邮箱地址格式不正确!");
         return(false);
     }
     else
     {
         return(true);
     }
 }
    /// <summary>
    /// 更新子物体的位置和角度
    /// </summary>
    /// <param name="root"></param>
    void UpdateChild(Transform root)
    {
        CustomTransform ctrans = root.GetComponent <CustomTransform>();

        if (ctrans != null)
        {
            UpdateTrans(ctrans);
            Transform trans = root.transform;
            for (int i = 0; i < trans.childCount; i++)
            {
                UpdateChild(trans.GetChild(i));
            }
        }
    }
Ejemplo n.º 10
0
Archivo: Actor.cs Proyecto: weijunhu/vs
    public virtual void Move()
    {
        CustomTransform mTrans       = GetComponent <CustomTransform>();
        CustomTransform mRotateTrans = RotateTransform.GetComponent <CustomTransform>();
        CustomVector3   temp;

        FixedPointF x = CustomMath.GetCos(mRotateTrans.Angle);
        FixedPointF z = CustomMath.GetSin(mRotateTrans.Angle);

        temp.x = x * Speed * LockStepConfig.mRenderFrameRate;
        temp.y = new FixedPointF(0);
        temp.z = z * Speed * LockStepConfig.mRenderFrameRate;

        mTrans.LocalPosition += temp;
    }
 public virtual Vector2 GetAnchorMin()
 {
     anchorMinPoint = transform.position;
     if (AdaptToParent)
     {
         CustomTransform parentTf = GetParent();
         if (parentTf == null)
         {
             return(anchorMinPoint);
         }
         Vector2 parentMax = parentTf.pointMax;
         Vector2 parentMin = parentTf.pointMin;
         anchorMinPoint = new Vector2(Mathf.Lerp(parentMin.x, parentMax.x, anchorMinRatio.x), Mathf.Lerp(parentMin.y, parentMax.y, anchorMinRatio.y));
     }
     return(anchorMinPoint);
 }
Ejemplo n.º 12
0
        private void Awake()
        {
            if (playerTransform == null)
            {
                playerTransform = GetComponent <Transform>();
            }

            if (playerNavMeshMovementController == null)
            {
                playerNavMeshMovementController = GetComponent <PlayerNavMeshMovementController>();
            }

            initialTransform = new CustomTransform()
            {
                position = playerTransform.position,
                rotation = playerTransform.eulerAngles,
                scale    = playerTransform.localScale
            };
        }
Ejemplo n.º 13
0
    void Render()
    {
        if (cursor >= frameData.Count)
        {
            return;
        }
        int             currentFrame     = frameData[cursor].frame;
        CustomTransform currentFrameData = frameData[cursor++];

        while (cursor < frameData.Count && currentFrame == frameData[cursor].frame)
        {
            if (currentFrameData.index < serializedObjects.Count)
            {
                serializedObjects[currentFrameData.index].transform.position = currentFrameData.position;
                serializedObjects[currentFrameData.index].transform.rotation = Quaternion.Euler(currentFrameData.rotation);
            }
            else
            {
                GameObject target;
                if (handGameObjects.TryGetValue(currentFrameData.index, out target))
                {
                    target.transform.position = currentFrameData.position;
                }
                else
                {
                    target = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                    target.transform.localScale = Vector3.one / 100;
                    handGameObjects.Add(currentFrameData.index, target);
                }
            }
            currentFrameData = frameData[cursor++];
        }
        //Cylinder
        for (int i = 0; i < 5; i++)     //finger count
        {
            for (int j = 0; j < 2; j++) //finger joint count
            {
                GameObject target;
                GameObject leftStart = null;
                handGameObjects.TryGetValue(GetLeftHandIndex(i, j), out leftStart);
                if (leftStart != null)
                {
                    if (handGameObjects.TryGetValue(GetLeftHandCylinderIndex(i, j), out target))
                    {
                        RepositionCylinderWithTwoPoints(leftStart.transform.position, handGameObjects[GetLeftHandIndex(i, j + 1)].transform.position, target);
                    }
                    else
                    {
                        handGameObjects.Add(GetLeftHandCylinderIndex(i, j), CreateCylinderWithTwoPoints(leftStart.transform.position, handGameObjects[GetLeftHandIndex(i, j + 1)].transform.position, 0.003f));
                    }
                }
                GameObject rightStart = null;
                handGameObjects.TryGetValue(GetRightHandIndex(i, j), out rightStart);
                if (rightStart != null)
                {
                    if (handGameObjects.TryGetValue(GetRightHandCylinderIndex(i, j), out target))
                    {
                        RepositionCylinderWithTwoPoints(rightStart.transform.position, handGameObjects[GetRightHandIndex(i, j + 1)].transform.position, target);
                    }
                    else
                    {
                        handGameObjects.Add(GetRightHandCylinderIndex(i, j), CreateCylinderWithTwoPoints(rightStart.transform.position, handGameObjects[GetRightHandIndex(i, j + 1)].transform.position, 0.003f));
                    }
                }
            }
        }
    }
    public override void OnInspectorGUI()
    {
        CustomTransform customTransform = (CustomTransform)target;

        base.OnInspectorGUI();
    }
Ejemplo n.º 15
0
 protected virtual void Reset()
 {
     mTrans = GetComponent <CustomTransform>();
 }
Ejemplo n.º 16
0
 public void SetData(CustomTransform position, CustomTransform rotation, FixedPointF speed)
 {
     _PositionTf = position;
     _RotationTf = rotation;
     _MoveSpeed  = speed;
 }