<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using KSP;
using UnityEngine;
using KSPPluginFramework;

namespace KSPAlternateResourcePanel
{
    class ARPPartWindow : MonoBehaviourWindow
    {
        //internal ARPPartWindow(Part Part)
        //{
        //    this.Part = Part;
        //    this.ResourceList = new ARPResourceList(ARPResourceList.ResourceUpdate.SetValues);
        //}

        //TODO: Look at using this
        //  http://answers.unity3d.com/questions/445444/add-component-in-one-line-with-parameters.html

        /// <summary>
        /// Have to take this out of the constructor as the object must be created using gameObject.addComponent<>
        /// </summary>
        /// <param name="Part">Part that this window is displaying info for</param>
        internal void Init(Part Part,KSPAlternateResourcePanel mbARP)
        {
            this.mbARP = mbARP;
            this.settings = KSPAlternateResourcePanel.settings;
            this.PartRef = Part;
            this.ResourceList = new ARPResourceList(ARPResourceList.ResourceUpdate.SetValues,settings.Resources);
            this.LeftSide = this.PartScreenPos.x < (mbARP.vectVesselCOMScreen.x - 3);
        }

        //Details about the part attached to this window
        internal Int32 PartID { get { return PartRef.GetInstanceID(); } }
        internal Part PartRef { get; private set; }

        //What resources are we displaying for this part
        internal ARPResourceList ResourceList;

        //Parent Objects
        internal KSPAlternateResourcePanel mbARP;
        internal Settings settings;

        /// <summary>
        /// Screen location of the Part
        /// </summary>
        internal Vector3d PartScreenPos { get {
            return FlightCamera.fetch.mainCamera.WorldToScreenPoint(this.PartRef.transform.position);
        }
        }

        //Where are we drawing it...
        internal Boolean LeftSide;
        internal static Single SideThreshold = 8;
        internal static Single WindowOffset = 200;
        internal static Single WindowSpaceOffset = 5;
        internal static Single WindowWidthForBars = 169;
        internal static Single WindowWidthForFlowControl = 20;

        internal static Int32 Icon2BarOffset = 36;

        //Line stuff
        Color colorLineCurrent = new Color(207, 207, 207);
        //GameObject lineObj;
        //internal LineRenderer linePart2Window;
        //internal Vector3 vectLinePartEnd;
        //internal Vector3 vectLineWindowEnd;
        //internal Color LineColor;

        //Colors for part and line highlighting
        Color colorHighlight = new Color(0, 0, .8f, .75f);
        Color colorLineHighlight = new Color(.1f, .1f, .8f, .6f);

        /// <summary>
        /// Set the window size and whether its left/right of the vessel
        /// </summary>
        private void UpdateWindowSizeAndVariables()
        {
            WindowWidthForFlowControl = mbARP.windowDebug.intTest1;

            Rect NewPosition = new Rect(WindowRect);
            NewPosition.width = WindowWidthForBars + WindowWidthForFlowControl;
            NewPosition.height = ((this.ResourceList.Count + 1 + this.TransfersCount ) * mbARP.windowMain.intLineHeight) + 1;

            //where to position the window<commit_msg>Flow Control width value fixed (relates to #65)<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using KSP;
using UnityEngine;
using KSPPluginFramework;

namespace KSPAlternateResourcePanel
{
    class ARPPartWindow : MonoBehaviourWindow
    {
        //internal ARPPartWindow(Part Part)
        //{
        //    this.Part = Part;
        //    this.ResourceList = new ARPResourceList(ARPResourceList.ResourceUpdate.SetValues);
        //}

        //TODO: Look at using this
        //  http://answers.unity3d.com/questions/445444/add-component-in-one-line-with-parameters.html

        /// <summary>
        /// Have to take this out of the constructor as the object must be created using gameObject.addComponent<>
        /// </summary>
        /// <param name="Part">Part that this window is displaying info for</param>
        internal void Init(Part Part,KSPAlternateResourcePanel mbARP)
        {
            this.mbARP = mbARP;
            this.settings = KSPAlternateResourcePanel.settings;
            this.PartRef = Part;
            this.ResourceList = new ARPResourceList(ARPResourceList.ResourceUpdate.SetValues,settings.Resources);
            this.LeftSide = this.PartScreenPos.x < (mbARP.vectVesselCOMScreen.x - 3);
        }

        //Details about the part attached to this window
        internal Int32 PartID { get { return PartRef.GetInstanceID(); } }
        internal Part PartRef { get; private set; }

        //What resources are we displaying for this part
        internal ARPResourceList ResourceList;

        //Parent Objects
        internal KSPAlternateResourcePanel mbARP;
        internal Settings settings;

        /// <summary>
        /// Screen location of the Part
        /// </summary>
        internal Vector3d PartScreenPos { get {
            return FlightCamera.fetch.mainCamera.WorldToScreenPoint(this.PartRef.transform.position);
        }
        }

        //Where are we drawing it...
        internal Boolean LeftSide;
        internal static Single SideThreshold = 8;
        internal static Single WindowOffset = 200;
        internal static Single WindowSpaceOffset = 5;
        internal static Single WindowWidthForBars = 169;
        internal static Single WindowWidthForFlowControl = 16;

        internal static Int32 Icon2BarOffset = 36;

        //Line stuff
        Color colorLineCurrent = new Color(207, 207, 207);
        //GameObject lineObj;
        //internal LineRenderer linePart2Window;
        //internal Vector3 vectLinePartEnd;
        //internal Vector3 vectLineWindowEnd;
        //internal Color LineColor;

        //Colors for part and line highlighting
        Color colorHighlight = new Color(0, 0, .8f, .75f);
        Color colorLineHighlight = new Color(.1f, .1f, .8f, .6f);

        /// <summary>
        /// Set the window size and whether its left/right of the vessel
        /// </summary>
        private void UpdateWindowSizeAndVariables()
        {
            Rect NewPosition = new Rect(WindowRect);
            NewPosition.width = WindowWidthForBars + WindowWidthForFlowControl;
            NewPosition.height = ((this.ResourceList.Count + 1 + this.TransfersCount ) * mbARP.windowMain.intLineHeight) + 1;

            //where to position the window
{'fraction_non_alphanumeric': 0.08555907650520597, 'fraction_numerical': 0.015240682058246567, 'mean_word_length': 2.300796812749004, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6068713', 'n_tokens_mistral': 1821, 'n_tokens_neox': 1688, 'n_words': 496}