public void Set(Vector2 p, float fWidth, int iFontSize, AnimationCurve _curve, Action <AnimationCurve> f) { rect = new Rect(p.x - fWidth, p.y, fWidth, 0f); fRightPos = p.x + fWidth; fUpPos = p.y; gsLabel.fontSize = iFontSize; gsButton.fontSize = iFontSize; gsText.fontSize = iFontSize; fMargin = iFontSize * 0.3f; func = f; curve = _curve; keys[0] = _curve.keys[0]; keys[1] = _curve.keys[1]; fCurve[0] = keys[0].outTangent; fCurve[1] = keys[0].value; fCurve[2] = keys[1].inTangent; fCurve[3] = keys[1].value; sValues[0] = fCurve[0].ToString(); sValues[1] = fCurve[1].ToString(); sValues[2] = fCurve[2].ToString(); sValues[3] = fCurve[3].ToString(); texture = GlobalCurveWindow.CreateCurveTexture(curve, false); show = true; }
private void CreateCurve() { keys[0].outTangent = fCurve[0]; keys[0].value = fCurve[1]; keys[1].inTangent = fCurve[2]; keys[1].value = fCurve[3]; curve = new AnimationCurve(keys); texture = GlobalCurveWindow.CreateCurveTexture(curve, false); }
///------------------------------------------------------------------------- /// <summary>GUI処理</summary> ///------------------------------------------------------------------------- public void OnGUI() { try { // 機能有効の場合 // if( this.Enable ) this.envView.ShowGizmos(GizmoRender.UIVisible); if (GizmoRender.UIVisible) { // 補助キーの押下有無確認 bool isCtrl = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); bool isShift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); bool isAlt = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt); // 表示中 if (this.modeSelectView.SelectedMode != ConstantValues.EditMode.Disable) { float windowWidth = Screen.width / 4 - ControlBase.FixedMargin * 2; // Vector2 point = new Vector2( Input.mousePosition.x, Screen.height - Input.mousePosition.y ); Rect pluginPos = new Rect(Screen.width - windowWidth, Screen.height / 15 + ControlBase.FixedMargin, Screen.width / 5 - Screen.width / 65, Screen.height - Screen.height / 5); // プラグイン画面の外にある場合、かつ補助キーを押下していない場合 // bool isEnableControl = ( pluginPos.Contains( point ) == false && ( isCtrl == false && isShift == false && isAlt == false ) ); // GameMain.Instance.MainCamera.SetControl( isEnableControl ); // UICamera.InputEnable = isEnableControl; // モード選択ウィンドウ this.modeSelectView.OnGUI(); // メイド設定中 if (this.modeSelectView.SelectedMode == ConstantValues.EditMode.Effect) { // メイド設定ウィンドウ this.effectView.rectGui.x = this.modeSelectView.Left; this.effectView.rectGui.y = this.modeSelectView.Top + this.modeSelectView.Height + ControlBase.FixedMargin; this.effectView.Left = 0; this.effectView.Top = 0; this.effectView.Width = this.modeSelectView.Width; this.effectView.rectGui.width = this.effectView.Width; this.effectView.OnGUI(); } // 環境設定中 else if (this.modeSelectView.SelectedMode == ConstantValues.EditMode.Environment) { // 環境設定ウィンドウ this.envView.rectGui.x = this.modeSelectView.Left; this.envView.rectGui.y = this.modeSelectView.Top + this.modeSelectView.Height + ControlBase.FixedMargin; this.envView.Left = 0; this.envView.Top = 0; this.envView.Width = this.modeSelectView.Width; this.envView.rectGui.width = this.envView.Width; this.envView.OnGUI(); } else if (this.modeSelectView.SelectedMode == ConstantValues.EditMode.Data) { // 環境設定ウィンドウ this.dataView.rectGui.x = this.modeSelectView.Left; this.dataView.rectGui.y = this.modeSelectView.Top + this.modeSelectView.Height + ControlBase.FixedMargin; this.dataView.Left = 0; this.dataView.Top = 0; this.dataView.Width = this.modeSelectView.Width; this.dataView.rectGui.width = this.dataView.Width; this.dataView.OnGUI(); } // update external windows // only one of these are ever needed at a time GlobalComboBox.Update(); GlobalColorPicker.Update(); GlobalCurveWindow.Update(); GlobalItemPicker.Update(); GlobalTexturePicker.Update(); // Update SunShaftsDef.Update(); } else { // 補助キーを押下していない場合 bool isEnableControl = (isCtrl == false && isShift == false && isAlt == false); GameMain.Instance.MainCamera.SetControl(isEnableControl); UICamera.InputEnable = isEnableControl; } } // else // { // GameMain.Instance.MainCamera.SetControl( true ); // UICamera.InputEnable = true; // } } catch (Exception e) { Debug.LogError(e.ToString()); } }