public AxisConfigurationPanel(AxisConfig config, BindingsControlPanel bindings) : this() { mBindings = bindings; mConfigType = config.GetType(); Init(config); }
private void reloadButton_Click(object sender, EventArgs e) { AxisConfig config = (AxisConfig)mConfigType.Assembly.CreateInstance(mConfigType.FullName); Controls.Remove(mPanel); mPanel.Dispose(); Init(config); }
private void Init() { mTickListener = new Action(TickListener); mAxisConfig = new AxisCursorConfig(); foreach (IAxis axis in mInitialAxes) { AddAxis(axis); } }
private void LoadAxisConfig(TabPage page, AxisConfig config) { if (config.LoadBoundAxes) { AxisConfigurationPanel panel = new AxisConfigurationPanel(config, bindingsControlPanel); panel.Dock = DockStyle.Fill; page.Controls.Add(panel); } else { LoadConfig(page, config); } }
/// <summary> /// Creates a factory instance and adds a http application injecting facility. /// </summary> /// <param name="config">Config</param> /// <returns>New engine instance</returns> protected static IEngine CreateEngineInstance(AxisConfig config) { if (config != null && !string.IsNullOrEmpty(config.EngineType)) { var engineType = Type.GetType(config.EngineType); if (engineType == null) { throw new ConfigurationErrorsException("The type '" + config.EngineType + "' could not be found. Please check the configuration at /configuration/axis/engine[@engineType] or check for missing assemblies."); } if (!typeof(IEngine).IsAssignableFrom(engineType)) { throw new ConfigurationErrorsException("The type '" + engineType + "' doesn't implement 'Axis.Helpers.Infrastructure.IEngine' and cannot be configured in /configuration/axis/engine[@engineType] for that purpose."); } return(Activator.CreateInstance(engineType) as IEngine); } return(new AxisEngine()); }
/// <summary> /// Initialize components and plugins in the axis environment. /// </summary> /// <param name="config">Config</param> public void Initialize(AxisConfig config) { if (config.ApplicationType == "Api") { //register dependencies RegisterApiDependencies(config); } else { //register dependencies RegisterDependencies(config); //startup tasks if (!config.IgnoreStartupTasks) { RunStartupTasks(); } } }
/// <summary> /// Register dependencies /// </summary> /// <param name="config">Config</param> protected virtual void RegisterDependencies(AxisConfig config) { var builder = new ContainerBuilder(); var container = builder.Build(); //we create new instance of ContainerBuilder //because Build() or Update() method can only be called once on a ContainerBuilder. //dependencies var typeFinder = new WebAppTypeFinder(config); builder = new ContainerBuilder(); builder.RegisterInstance(config).As <AxisConfig>().SingleInstance(); builder.RegisterInstance(this).As <IEngine>().SingleInstance(); builder.RegisterInstance(typeFinder).As <ITypeFinder>().SingleInstance(); builder.Update(container); //register dependencies provided by other assemblies builder = new ContainerBuilder(); var drTypes = typeFinder.FindClassesOfType <IDependencyRegistrar>(); var drInstances = new List <IDependencyRegistrar>(); foreach (var drType in drTypes) { drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drType)); } //sort drInstances = drInstances.AsQueryable().OrderBy(t => t.Order).ToList(); foreach (var dependencyRegistrar in drInstances) { dependencyRegistrar.Register(builder, typeFinder); } builder.Update(container); this._containerManager = new ContainerManager(container); //set dependency resolver DependencyResolver.SetResolver(new AutofacDependencyResolver(container)); GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container); }
/// <summary> /// Input axes will automatically be assigned to camera axes if no axis is specified. /// The ordering is as follows: /// 1st axis: x /// 2nd axis: y /// 3rd axis: z /// 4th axis: pitch /// 5th axis : yaw /// Specify null if you do not which to assign that axis. /// </summary> /// <param name="name"></param> /// <param name="axes"></param> public AxisBasedDelta(string name, AxisConfig config, params IAxis[] axes) { Logger = LogManager.GetLogger(name); mName = name; mConfig = config; mTickListener = new Action(mCore_Tick); foreach (var axis in axes) { if (axis != null) { AddAxis(axis); } } #if DEBUG StatisticsCollection.AddStatistics(mStatistics, name); #endif }
private void Init(AxisConfig config) { foreach (var axis in mBindings.GetBoundClasses <IAxis>().Where(ax => !ax.IsAbstract)) { if (IsConstrained(axis)) { config.GetDeadzone(axis.Name); config.GetScale(axis.Name); } config.GetBinding(axis.Name); } mPanel = new ConfigurationObjectControlPanel(config); mPanel.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; mPanel.Location = new Point(0, reloadButton.Height); mPanel.Width = Width; mPanel.Height = Height - mPanel.Location.Y; Controls.Add(mPanel); }
// [SerializeField] // Material graphMaterial; protected override IEnumerator UpdateCoroutine() { do { Spy.StopwatchesStart("LineGraph.UpdateCoroutine() A"); needUpdate = false; var cornersArray = new Vector3[4]; viewRTF.GetWorldCorners(cornersArray); viewMinXGlobal = cornersArray[0].x; viewMaxXGlobal = cornersArray[2].x; #if DEBUG_DETAIL paramMemo += "viewMinXGlobal:" + viewMinXGlobal + "\n"; paramMemo += "viewMaxXGlobal:" + viewMaxXGlobal + "\n"; // Debug.LogWarning("@@@@@@@@viewMinXGlobal:" + viewMinXGlobal); // Debug.LogWarning("@@@@@@@@viewMaxXGlobal:" + viewMaxXGlobal); #endif // scrollRectを求める. // viewRTFよりも枠線分小さくする. var scrollRect = new Rect( hMainAxisConfig.lineThickness * 0.5f, vMainAxisConfig.lineThickness * 0.5f, (viewRTF.rect.width - hMainAxisConfig.lineThickness) * scaleH + hMainAxisConfig.lineThickness, (viewRTF.rect.height - vMainAxisConfig.lineThickness) * scaleV + vMainAxisConfig.lineThickness); var graphWidth = scrollRect.width - hMainAxisConfig.lineThickness; var graphHeight = scrollRect.height - vMainAxisConfig.lineThickness; var valueHDiff = (valueHMax - valueHMin); // Debug.LogWarning("@@@@@@@@valueHMin:" + valueHMin.ToString("MM / dd HH: mm")); // Debug.LogWarning("@@@@@@@@valueHMax:" + valueHMax.ToString("MM / dd HH: mm")); // Debug.LogWarning("@@@@@@@@TotalDays:" + valueHDiff.TotalDays); // Debug.LogWarning("@@@@@@@@Days:" + valueHDiff.Days); // Debug.LogWarning("@@@@@@@@m:" + valueHDiff.TotalMinutes); var valueVDiff = (valueVMax - valueVMin); graphScrollRect.content.pivot = Vector2.zero; graphScrollRect.content.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollRect.width); graphScrollRect.content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, scrollRect.height); // hTextScrollRectの位置調整. hTextScrollRect.content.pivot = Vector2.zero; hTextScrollRect.content.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, scrollRect.width); var hTextScrollRectRTF = hTextScrollRect.transform as RectTransform; hTextScrollRectRTF.offsetMin = new Vector2(viewRTF.offsetMin.x, 0); hTextScrollRectRTF.offsetMax = new Vector2(viewRTF.offsetMax.x, viewRTF.offsetMax.y - viewRTF.rect.height); // vTextScrollRectの位置調整. vTextScrollRect.content.pivot = Vector2.zero; vTextScrollRect.content.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, scrollRect.height); var vTextScrollRectRTF = vTextScrollRect.transform as RectTransform; vTextScrollRectRTF.offsetMin = new Vector2(0, viewRTF.offsetMin.y); vTextScrollRectRTF.offsetMax = new Vector2(viewRTF.offsetMax.x - viewRTF.rect.width, viewRTF.offsetMax.y); var valueHMaxTick = valueHMax.Ticks; Spy.StopwatchesStop("LineGraph.UpdateCoroutine() A"); Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreateHorizontal"); // List<Vector2> lineListMain = new List<Vector2>(); // List<Vector2> lineListSub = new List<Vector2>(); List <UILines.UILineData> lineData = new List <UILines.UILineData>(); { // Create horizontal objects. var divisions = hMainDivisions * hSubDivisions * scaleH; for (var idx = 0; idx < divisions + 1; ++idx) { var posH = scrollRect.x + (graphWidth / divisions) * idx; AxisConfig ac = (idx % hSubDivisions == 0) ? hMainAxisConfig : hSubAxisConfig; // if (ac.linePrefabPool != null) { // Line. #if true // Add horizontal line data.(縦線データの追加.) var ld = new UILines.UILineData( new Vector2(posH, 0), new Vector2(posH, scrollRect.height), ac.lineThickness, ac.lineColor); lineData.Add(ld); #else // Create horizontal line.(縦線.) var lineRTF = ac.linePrefabPool.Rent() as RectTransform; lineRTF.anchorMin = Vector2.zero; lineRTF.anchorMax = Vector2.zero; lineRTF.pivot = new Vector2(0.5f, 0.0f); lineRTF.anchoredPosition = new Vector2(posH, 0); lineRTF.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, ac.lineThickness); lineRTF.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, scrollRect.height); lineRTF.eulerAngles = Vector3.zero; lineRTF.GetComponent <Image>().color = ac.lineColor; #endif } if (ac.textPrefabPool != null) { // Text. // Create horizontal text. var val = valueHMin.Ticks + (long)(valueHDiff.Ticks / divisions) * idx; var textRTF = ac.textPrefabPool.Rent() as RectTransform; textRTF.anchorMin = Vector2.up; textRTF.anchorMax = Vector2.up; textRTF.pivot = new Vector2(0.5f, 1.0f); textRTF.anchoredPosition = new Vector2(posH + ac.textOffset.x, ac.textOffset.y); var text = textRTF.GetComponent <Text>(); text.text = new DateTime(val).Round(new TimeSpan(0, 1, 0)).ToString("MM/dd HH:mm"); // 分で丸める. if (textRTF.position.x < viewMinXGlobal - H_TEXT_COLOR_CHANGE_OFFSET || viewMaxXGlobal + H_TEXT_COLOR_CHANGE_OFFSET < textRTF.position.x) { text.color = new Color(ac.textColor.r, ac.textColor.g, ac.textColor.b, 0.0f); } else { text.color = ac.textColor; } hTextTFList.Add(textRTF); } } #if true /* var graphLineRTF = graphLinePrefabPool.Rent() as RectTransform; * graphLineRTF.SetParent(graphScrollRect.content, false); * graphLineRTF.anchorMin = Vector2.zero; * graphLineRTF.anchorMax = Vector2.zero; * graphLineRTF.pivot = Vector2.zero; * graphLineRTF.anchoredPosition = Vector2.zero; * var polygonalLine = graphLineRTF.GetComponent<UIPolygonalMesh>(); * polygonalLine.width = lineThickness; * polygonalLine.color = lineColor; * polygonalLine.points = lineList.ToArray(); */ #endif } Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreateHorizontal"); Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreateVertical"); { // Create vertical objects. /* if(true) * { * var graphRenderer = GameObjectEx.InstantiateEmptyToChild<UIPolygonalLineFast>(gameObject); * graphRenderer.material = graphMaterial; * graphRenderer.width = 10; * graphRenderer.points = new List<Vector2>(); * var corners = new Vector3[4]; * viewRTF.GetLocalCorners(corners); * graphRenderer.points.Add(corners[0]); * graphRenderer.points.Add(corners[1]); * graphRenderer.points.Add(corners[2]); * graphRenderer.points.Add(corners[3]); * }*/ var divisions = vMainDivisions * vSubDivisions; for (var idx = 0; idx < divisions + 1; ++idx) { var posV = scrollRect.y + (graphHeight / divisions) * idx; AxisConfig ac = (idx % vSubDivisions == 0) ? vMainAxisConfig : vSubAxisConfig; // if (ac.linePrefabPool != null) { // Line. // Add vertical line data.(横線データの追加.) var ld = new UILines.UILineData( new Vector2(0, posV), new Vector2(scrollRect.width, posV), ac.lineThickness, ac.lineColor); lineData.Add(ld); } if (ac.textPrefabPool != null) { // Text. // Create vertical text. var val = valueVMin + (valueVDiff / divisions) * idx; var textRTF = ac.textPrefabPool.Rent() as RectTransform; textRTF.anchorMin = Vector2.right; textRTF.anchorMax = Vector2.right; textRTF.pivot = Vector2.right; textRTF.anchoredPosition = new Vector2(ac.textOffset.x, posV + ac.textOffset.y); var text = textRTF.GetComponent <Text>(); text.text = val.ToString("0." + new string('0', ac.fractionalDigits)); text.color = ac.textColor; } } } Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreateVertical"); Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreatePosArray"); var posArray = new Vector2[valList.Count]; { for (var idx = 0; idx < valList.Count; ++idx) { var val = valList[idx]; var valH = val.Key; var valV = val.Value; posArray[idx] = new Vector2( scrollRect.y + (graphWidth / valueHDiff.Ticks) * (valH.Ticks - valueHMin.Ticks), scrollRect.y + (graphHeight / valueVDiff) * (valV - valueVMin)); } } Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreatePosArray"); // Debug.Log("posArray.Length :"+ posArray.Length); // posArray = posArray.ToList().GetRange(169, 14).ToArray(); Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreateBackLine"); if (lineData.Count != 0) { var uiLines = GameObjectEx.InstantiateEmptyToChild <UILines>(graphScrollRect.content.gameObject); uiLines.lineDataArray = lineData.ToArray(); uiLines.raycastTarget = false; var polygonalRTF = uiLines.rectTransform; polygonalRTF.anchorMin = Vector2.zero; polygonalRTF.anchorMax = Vector2.zero; polygonalRTF.pivot = Vector2.zero; polygonalRTF.anchoredPosition = Vector2.zero; } Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreateBackLine"); Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreateLine"); //graphLinePrefabPool = null; if (posArray.Length > 1 && graphLinePrefabPool != null) { // Create line. const int MAX_VERTS = 64000 / 10; // 本来65000/9ぐらいだが、バグが怖いので余裕を持っておく. /* * // テスト用に頂点を増やす. * var a2 = new Vector2[posArray.Length]; * Array.Copy(posArray, a2, posArray.Length); * var posList = posArray.ToList(); * while(posList.Count < MAX_VERTS / 4) * { * posList.AddRange(a2); * * } * posArray = posList.ToArray(); */ // 65000頂点までしか対応していない為、分割する. if (posArray.Length < MAX_VERTS) { Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreateLine A"); var graphLineRTF = graphLinePrefabPool.Rent() as RectTransform; graphLineRTF.SetParent(graphScrollRect.content, false); graphLineRTF.anchorMin = Vector2.zero; graphLineRTF.anchorMax = Vector2.zero; graphLineRTF.pivot = Vector2.zero; graphLineRTF.anchoredPosition = Vector2.zero; var polygonalLine = graphLineRTF.GetComponent <UIPolygonalMesh>(); polygonalLine.width = lineThickness; polygonalLine.color = lineColor; polygonalLine.points = posArray; Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreateLine A"); } else { Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreateLine B"); const int ChunkSize = MAX_VERTS; // Debug.Log("posArray.Length:" + posArray.Length); var loopNum = (posArray.Length - 1) / ChunkSize + 1; for (var idx = 0; idx < loopNum; ++idx) { var offset = ChunkSize * idx; var count = (idx + 1 == loopNum) ? (posArray.Length - (idx * ChunkSize)) : ChunkSize; // つなぎ目の描画がきれいになるように2つ分多めに計算する. count = (offset + count + 2 <= posArray.Length) ? (count + 2) : (posArray.Length - offset); #if false { // .Net4.5以前なのでArraySegmentを活用できない. var arraySegment = new ArraySegment <Vector2>(posArray, offset, count); Debug.Log("idx:" + idx + ", arraySegment.Length:" + arraySegment.Count); for (int index = arraySegment.Offset; index <= arraySegment.Offset + arraySegment.Count - 1; index++) { Debug.Log(" vvv:" + arraySegment.Array[index]); } } #endif var arraySeg = new Vector2[count]; Array.Copy(posArray, offset, arraySeg, 0, count); var graphLineRTF = graphLinePrefabPool.Rent() as RectTransform; graphLineRTF.SetParent(graphScrollRect.content, false); graphLineRTF.anchorMin = Vector2.zero; graphLineRTF.anchorMax = Vector2.zero; graphLineRTF.pivot = Vector2.zero; graphLineRTF.anchoredPosition = Vector2.zero; var polygonalLine = graphLineRTF.GetComponent <UIPolygonalMesh>(); polygonalLine.width = lineThickness; polygonalLine.color = lineColor; polygonalLine.points = arraySeg; } Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreateLine B"); } } Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreateLine"); /* * Spy.StopwatchesStart("LineGraph.UpdateCoroutine() CreatePoints"); * // Create points. * if (pointPrefabPool != null) * { * foreach (var pos in posArray) * { * var pointRTF = pointPrefabPool.Rent() as RectTransform; * pointRTF.anchorMin = Vector2.zero; * pointRTF.anchorMax = Vector2.zero; * pointRTF.pivot = new Vector2(0.5f, 0.5f); * pointRTF.anchoredPosition = pos; * pointRTF.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, pointSize); * pointRTF.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, pointSize); * pointRTF.GetComponent<Image>().color = pointColor; #if UNITY_EDITOR * pointRTF.GetComponent<Image>().color = ColorEx.Random; #endif * } * } * Spy.StopwatchesStop("LineGraph.UpdateCoroutine() CreatePoints"); */ // 開始時のスクロールバーの位置を設定する. graphScrollRect.normalizedPosition = Vector2.right; hTextScrollRect.normalizedPosition = Vector2.right; // Debug.Log("scrollRect.width:" + scrollRect.width); // Debug.Log("scrollRect.x:" + scrollRect.x); // Debug.Log("graphWidth:" + graphWidth); // Debug.Log("posArray[posArray.Length-1].x:" + posArray[posArray.Length-1].x); // Debug.Log("viewRTF:" + viewRTF.rect.xMin + ", " + viewRTF.rect.xMax); // Debug.Log("viewRTF.rect.width:" + viewRTF.rect.width); var r = (posArray[posArray.Length - 1].x - viewRTF.rect.width) / (scrollRect.width - viewRTF.rect.width); var normalizedPosition = new Vector2(r, 0); // Debug.Log("r:" + r); graphScrollRect.normalizedPosition = normalizedPosition; hTextScrollRect.normalizedPosition = normalizedPosition; } while (needUpdate); updateCoroutine = null; yield break; }
public HomeWaitUI(AxisConfig axis) { InitializeComponent(); _Axis = axis; }
public WebAppTypeFinder(AxisConfig config) { this._ensureBinFolderAssembliesLoaded = config.DynamicDiscovery; }