예제 #1
2
파일: SelectHelper.cs 프로젝트: LuoSven/EM
 public static SelectList GetSelectList(SelectType selectType)
 {
     switch (selectType)
      {
          case SelectType.User:
              var userList = userAccountRepo.GetSelectList();
              return new SelectList(userList, "Key", "Value");
          default:
              return null;
      }
 }
예제 #2
1
 public Select(SelectType type)
 {
     this.Type = type;
     this.Fields = new List<string>();
 }
예제 #3
1
 public CardSelector(IList<ClientCard> cards)
 {
     _type = SelectType.Cards;
     _cards = cards;
 }
예제 #4
1
        /// <summary>
        /// 注意 このメソッドは人を選択したタイミングで行う必要がある
        /// </summary>
        public override void LoadContent()
        {
            base.LoadContent();

            isProfileMain = true;
            selectType = SelectType.Era;

            //背景
            backTexture = mainGame.Content.Load<Texture2D>("Profile/ProfileBack");
            rectangle = new Rectangle(50, height / 100, width - 100, height * 98 / 100);

            //選択部を作成
            selects = new BaseGame[2];
            selects[(int)SelectType.Era] = new EraSelect(mainGame);
            selects[(int)SelectType.Era].LoadContent();
            selects[(int)SelectType.Map] = new AreaSelect(mainGame);
            selects[(int)SelectType.Map].LoadContent();

            //プロフィールを表示するため
            profileText = new ProfileText(mainGame,new Rectangle(rectangle.X,rectangle.Y+100,rectangle.Width,rectangle.Height-200));
            profileText.LoadContent();
            profileImage = new ProfileImage(mainGame, new Rectangle(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height * 2 / 9, rectangle.Height*5/10, rectangle.Height*5/10));
            profileImage.LoadContent();

            //ボタンを作成
            buttons = new Texture2D[2];
            buttons[(int)SelectType.Era] = mainGame.Content.Load<Texture2D>("Profile/era");
            buttons[(int)SelectType.Map] = mainGame.Content.Load<Texture2D>("Profile/map");
            buttonRectangles = new Rectangle[2];
            for (int i = 0; i < buttonRectangles.Length; i++)
            {
                buttonRectangles[i] = new Rectangle(rectangle.X + (rectangle.Width / 7) * (3*i+1), rectangle.Y + rectangle.Height * 3 / 4,
                                                                rectangle.Width *2 / 7, rectangle.Height / 5);
            }

            //フェードインを有効に
            fadeIn.isEnabled = true;
        }
예제 #5
1
        public override void Update()
        {
            //出来事選択部
            if(fadeOut.isEnd)
            {
                selects[(int)selectType].Update();
            }
            //メインのプロフィール
            else if (isProfileMain)
            {
                profileText.Update();
                profileImage.Update();

                //選択する
                if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Right) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right))
                {
                    selectType++;
                    if ((int)selectType > 1)
                    {
                        selectType = (SelectType)1;
                    }
                }
                if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Left) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left))
                {
                    selectType--;
                    if ((int)selectType < 0)
                    {
                        selectType = (SelectType)0;
                    }
                }

                //決定
                if (beforeKeyboardState.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Enter) && nowKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter))
                {
                    isProfileMain = false;
                    fadeOut.isEnabled = true;
                }
            }

            base.Update();
        }
 public StudABCardReportForm(SelectType selType,List<string> StudentIDList)
 {
     InitializeComponent();
     _UserSelectType = selType;
     _UDTTransfer = new UDTTransfer();
     _bgWorker = new BackgroundWorker();
     _dtTable = new DataTable();
     _StudentIDList = StudentIDList;
     _bgWorker.WorkerReportsProgress = true;
     _bgWorker.DoWork += new DoWorkEventHandler(_bgWorker_DoWork);
     _bgWorker.ProgressChanged += new ProgressChangedEventHandler(_bgWorker_ProgressChanged);
     _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
 }
 private ComboBox CreateCombox(JiraField field, List<NameValue> datasource, SelectType type = SelectType.Common)
 {
     var select = new ComboBox();
     select.DropDownStyle = ComboBoxStyle.DropDownList;
     select.DisplayMember = "Name";
     select.ValueMember = "Value";
     select.Width = 230;
     select.TabIndex = 99 - CurrentFieldCount;
     var first = datasource.FirstOrDefault();
     var firstValue = first == null ? String.Empty : first.Name;
     var format = String.Empty;
     switch (type)
     {
         case SelectType.Common:
             format = CUSTOM_FIELD_VALUE_SELECT_FORMAT;
             break;
         case SelectType.Version:
             format = CUSTOM_FIELD_VALUE_VERSION_SELECT_FORMAT;
             break;
         default:
             format = CUSTOM_FIELD_VALUE_SELECT_FORMAT;
             break;
     }
     select.Tag = new ControlTagPackage
     {
         Field = field,
         ID = field.Schema.CustomID,
         SerializedString = String.Format(format, field.Schema.CustomID, firstValue, "{", "}")
     };
     select.DataSource = datasource;
     select.SelectedIndexChanged += select_SelectedIndexChanged;
     return select;
 }
예제 #8
0
        protected IEnumerable <NamedType> GetAddedTypes(SelectType o, SelectType n)
        {
            var oSpecific = GetAllSpecific(o).ToList();
            var nSpecific = GetAllSpecific(n).ToList();

            return(nSpecific.Where(s => oSpecific.All(ns => ns.Name != s.Name)));
        }
예제 #9
0
        private Cube SelectCube(List <Cube> cubes, SelectType select)
        {
            Cube result = cubes[0];

            if (select == SelectType.LongSide)
            {
                int length = 0;
                foreach (var item in cubes)
                {
                    if (item.IsCalcMinMax == false)
                    {
                        CalcMinMax(item);
                    }
                    if (length < item.Max - item.Min)
                    {
                        result = item;
                        length = item.Max - item.Min;
                    }
                }
            }
            else if (select == SelectType.MostPixels)
            {
                foreach (var item in cubes)
                {
                    if (result.Pixels.Length < item.Pixels.Length)
                    {
                        result = item;
                    }
                }
            }
            return(result);
        }
예제 #10
0
        /// <summary>
        /// Cubeを分割してCubeのリスト作成
        /// </summary>
        /// <param name="count">分割数</param>
        /// <param name="select">分割するCubeを選択する方法</param>
        /// <param name="split">Cubeを分割する方法</param>
        public void Split(int count, SelectType select, SplitType split)
        {
            Cubes.Clear();
            Cubes.Add(this);
            var confirmCubes = new List <Cube>();//これ以上分割できないCube隔離用

            while (Cubes.Count + confirmCubes.Count < count)
            {
                Cube cube = SelectCube(Cubes, select);
                var(cubeA, cubeB) = SplitCube(cube, split);
                if (cubeA.Pixels.Length == 0 || cubeB.Pixels.Length == 0)
                {
                    //分割できなかったCubeを隔離用リストに移動
                    confirmCubes.Add(cube);
                    Cubes.Remove(cube);
                    //分割できるCubeが尽きたらループ抜け
                    if (Cubes.Count == 0)
                    {
                        break;
                    }
                }
                else
                {
                    //分割できたCubeをリストから削除して、分割したCubeを追加
                    Cubes.Remove(cube);
                    Cubes.Add(cubeA);
                    Cubes.Add(cubeB);
                }
            }
            //隔離しておいたCubeを戻す
            foreach (var item in confirmCubes)
            {
                Cubes.Add(item);
            }
        }
예제 #11
0
 public void ShowWnd(SelectType type, int SortType)
 {
     btn_OK.onClick.Add(new EventDelegate(OnOK));
     selectNum = 0;
     selectList.Clear();
     if (type == SelectType.ItemSell)
     {
         sellType |= (1 << 1);
         sellPanel.SetActive(true);
         sellPanel.transform.FindChild("btn_sellWhite").FindChild("Background").GetComponent <UISprite>().spriteName = "btn_2dis";
         sellPanel.transform.FindChild("btn_sellWhite").FindChild("effected").GetComponent <UISprite>().spriteName   = "g2";
         sellPanel.transform.FindChild("btn_sellGreen").FindChild("Background").GetComponent <UISprite>().spriteName = "btn_2";
         sellPanel.transform.FindChild("btn_sellGreen").FindChild("effected").GetComponent <UISprite>().spriteName   = "";
         sellPanel.transform.FindChild("btn_sellBlue").FindChild("Background").GetComponent <UISprite>().spriteName  = "btn_2";
         sellPanel.transform.FindChild("btn_sellBlue").FindChild("effected").GetComponent <UISprite>().spriteName    = "";
         sortPanel.SetActive(false);
         moneyPanel.SetActive(true);
     }
     else
     {
         sellPanel.SetActive(false);
         sortPanel.SetActive(true);
         moneyPanel.SetActive(false);
         sdRadioButton btn = sortPanel.transform.FindChild("btn_sortLv").GetComponent <sdRadioButton>();
         btn.Active(true);
         sdUICharacter.Instance.ActiceRadioBtn(btn);
     }
     RefreshItem(type, SortType);
 }
예제 #12
0
 private void CallBackAction(SelectType type)
 {
     if (mDutySummaryActionCallBack != null)
     {
         mDutySummaryActionCallBack(type, this);
     }
 }
예제 #13
0
 private void OnSelectedMenu(SelectType selectType)
 {
     if (mMenuSelectedCallBack != null && mKeyController != null)
     {
         mMenuSelectedCallBack(selectType);
     }
 }
        public async void ProcessAsync_Should_Set_Standard_Hint_Type_ClassAttribute(SelectType type)
        {
            _tagHelper.SelectType = type;
            await _tagHelper.ProcessAsync(_tagHelperContext, _tagHelperOutput);

            Assert.Equal(CssClasses.NhsUkSelect, _tagHelperOutput.Attributes[HtmlAttributes.ClassAttribute].Value);
        }
예제 #15
0
        /// <summary>
        /// 实现圆选择查询
        /// </summary>
        /// <param name="control">地图视图控件</param>
        /// <param name="dataType">选择数据时的数据类型过滤</param>
        /// <param name="attctr">属性视图控件</param>
        /// <param name="seltype">查询选择方式:圆查询 </param>
        public CirSelectToolClass(MapGIS.GISControl.MapControl control, SelectDataType dataType, AttControl attctr, SelectType seltype)
            : base()
        {
            this.mapCtrl    = control;
            this.dataType   = dataType;
            this.attCtrl    = attctr;
            this.selectType = seltype;

            //查询选择项
            SelectOption selOpt = new SelectOption();

            selOpt.DataType  = dataType;               //选择数据时的类型过滤类型
            selOpt.SelMode   = SelectMode.Multiply;    //选择模式
            selOpt.UnMode    = UnionMode.Xor;          //结果数据合并模式
            selOpt.LayerCtrl = SelectLayerControl.All; //选择数据时的图层过滤类型

            //创建圆交互工具
            selTool           = new SelectTool(control, selectType, selOpt, SpaQueryMode.MBRIntersect, control.Transformation);
            selTool.Selected += new SelectTool.SelectHandler(selTool_Selected);
            this.Active      += new ToolEventHandler(CirSelectToolClass_Active);
            this.Unactive    += new ToolEventHandler(CirSelectToolClass_Unactive);
            this.Cancel      += new ToolEventHandler(CirSelectToolClass_Cancel);
            this.PreRefresh  += new ToolEventHandler(CirSelectToolClass_PreRefresh);
            this.PostRefresh += new ToolEventHandler(CirSelectToolClass_PostRefresh);
        }
예제 #16
0
    // Create a file for an option group from given data.
    internal static void CreateOptionGroup(DirectoryInfo baseFolder, SelectType type, string name,
                                           int priority, int index, string desc, IEnumerable <ISubMod> subMods)
    {
        switch (type)
        {
        case SelectType.Multi:
        {
            var group = new MultiModGroup()
            {
                Name        = name,
                Description = desc,
                Priority    = priority,
            };
            group.PrioritizedOptions.AddRange(subMods.OfType <SubMod>().Select((s, idx) => (s, idx)));
            IModGroup.Save(group, baseFolder, index);
            break;
        }

        case SelectType.Single:
        {
            var group = new SingleModGroup()
            {
                Name        = name,
                Description = desc,
                Priority    = priority,
            };
            group.OptionData.AddRange(subMods.OfType <SubMod>());
            IModGroup.Save(group, baseFolder, index);
            break;
        }
        }
    }
예제 #17
0
        /// <summary>
        /// 读取列表
        /// </summary>
        public static MDataTable GetList(string objName, SelectType st)
        {
            string where = "";
            switch (st)
            {
            case SelectType.Show:
                where = " and (Hidden=0 or Formatter='#')";
                break;

            case SelectType.Export:
                where = " and Export=1";
                break;

            case SelectType.Import:
                where = " and Import=1";
                break;

            case SelectType.ImportUnique:
                where = " and ImportUnique=1";
                break;
            }
            using (MAction action = new MAction(TableNames.Config_Grid))
            {
                return(action.Select(string.Format("ObjName='{0}' {1} order by frozen desc,OrderNum asc", objName, where)));
            }
        }
예제 #18
0
 public SelectPhrase(string name, string table, string alias, SelectType selectType)
     : base(name)
 {
     TableName = TableName;
     Alias     = alias;
     SType     = selectType;
 }
예제 #19
0
        /// <summary>
        /// 读取列表
        /// </summary>
        public static MDataTable GetList(string objName, SelectType st)
        {
            string where = "";
            switch (st)
            {
            case SelectType.Show:
                where = "Hidden=0 or Formatter='#'";
                break;

            case SelectType.Export:
                where = "Export=1";
                break;

            case SelectType.Import:
                where = "Import=1";
                break;

            case SelectType.ImportUnique:
                where = "ImportUnique=1";
                break;
            }
            MDataTable dt;

            using (MAction action = new MAction(U_AriesEnum.Config_Grid))
            {
                dt = action.Select(string.Format("ObjName='{0}' order by frozen desc,OrderNum asc", objName));
            }
            MDataTable dt2 = dt.FindAll(where);

            return(dt2 != null ? dt2 : dt.GetSchema(false));//自动缓存只存档一份,同时兼容文本数据库
        }
        /// <summary>
        /// This method is use for
        /// select option from dropdown list or combobox
        /// </summary>
        /// <param name="element"></param>
        /// <param name="type"></param>
        /// <param name="options"></param>
        public void Select(IWebElement element, SelectType type, string options)
        {
            SelectElement select = new SelectElement(element);

            switch (type)
            {
            case SelectType.SelectByIndex:
                try
                {
                    select.SelectByIndex(Int32.Parse(options));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.GetBaseException().ToString());
                    throw new ArgumentException("Please input numberic on selectOption for SelectType.SelectByIndex");
                }
                break;

            case SelectType.SelectByText:
                select.SelectByText(options);
                break;

            case SelectType.SelectByValue:
                select.SelectByValue(options);
                break;

            default:
                throw new Exception("Get error in using Selected");
            }
        }
예제 #21
0
        public void Initial_WindowSelect(SelectType selectType, WindowSearch <RT> userSearchForm)
        {
            this.selectType = selectType;
            if (selectType == SelectType.WindowSelectTree)
            {
                displayerControl = tree;
                tree.ContextMenu = null;
            }
            else
            {
                displayerControl             = dataGridExtended;
                dataGridExtended.ContextMenu = null;
            }

            APMGroupBoxDisplay.Content = displayerControl;
            var userDataGrid = (displayerControl is APMDataGridExtended) ? displayerControl as APMDataGridExtended : null;

            userXoperation = FieldNames <RT> .FixPart.Substring(0, FieldNames <RT> .FixPart.Length - 1);

            Initial_WindowBase(userDataGrid, APMToolBar, null, userXoperation, false, userSearchForm);

            if (txtName != null)
            {
                txtName.TextChanged += txtTextChanged;
            }
            if (txtCode != null)
            {
                txtCode.TextChanged += txtTextChanged;
            }
            GlobalFunctions.SetVisibilityForControl(txtCode, GlobalFunctions.PropertyExist(selectedRecord, FieldNames <RT> .Code));
            GlobalFunctions.SetVisibilityForControl(lblCode, GlobalFunctions.PropertyExist(selectedRecord, FieldNames <RT> .Code));
            GlobalFunctions.SetVisibilityForControl(APMGroupBoxGridGroup, selectType == SelectType.WindowSelectGridGroup);
        }
예제 #22
0
        private void SubmitPlayer(Input input)
        {
            CharacterType characterType = inputTypeMapping[input];
            SelectType    selectType    = inputSelectMapping[input];

            switch (selectType)
            {
            case SelectType.None:
                displayManager.UpdateCharacter(input.DeviceNum, characterType);
                displayManager.UpdateCharacterArrows(input.DeviceNum, true);
                displayManager.UpdateCharacterJoin(input.DeviceNum, false);
                displayManager.UpdateCharacterSelect(input.DeviceNum, true);

                inputSelectMapping[input] = SelectType.Join;
                break;

            case SelectType.Join:
                displayManager.UpdateCharacterArrows(input.DeviceNum, false);
                displayManager.UpdateCharacterJoin(input.DeviceNum, false);
                displayManager.UpdateCharacterSelect(input.DeviceNum, false);

                inputSelectMapping[input] = SelectType.Select;

                break;
            }

            if (JoinedPlayerCount > 0 || SelectPlayerCount < settings.minStartPlayers)
            {
                displayManager.UpdateCharacterStart(false);
            }
            else
            {
                displayManager.UpdateCharacterStart(true);
            }
        }
예제 #23
0
 public Cube3(byte[] pixels, SelectType selectType, SplitType splitType)
 {
     Pixels = pixels;
     CubeList.Add(this);
     SelectType = selectType;
     SplitType  = splitType;
 }
예제 #24
0
        //************************************************************************
        /// <summary>
        /// 指定された検索IDのSQLファイルからSELECT文を作成し、検索を実行する。
        /// </summary>
        /// <param name="argSelectIdList">検索IDリスト</param>
        /// <param name="argParamList">検索条件リスト</param>
        /// <param name="argSelectType">検索種別</param>
        /// <param name="argMessage">返却メッセージ</param>
        /// <returns>検索結果</returns>
        //************************************************************************
        public DataSet SelectList(List <SelectId> argSelectIdList, List <SelectParam> argParamList,
                                  SelectType argSelectType, out ApplicationMessage argMessage)
        {
            // 最大検索件数取得
            int maxRow = m_dataAccess.GetMaxRow();

            // 検索実行
            bool isOver;
            var  result = m_dataAccess.SelectList(argSelectIdList, argParamList, argSelectType, maxRow, out isOver);

            argMessage = null;
            // 検索結果なし
            if (result.Tables[0].Rows.Count == 0)
            {
                argMessage = new ApplicationMessage("IV001");
            }
            // 最大検索件数オーバー
            else if (isOver)
            {
                argMessage = new ApplicationMessage("IV002");
            }

            System.Threading.Thread.Sleep(5000);

            return(result);
        }
예제 #25
0
        //減色パレット作成
        private void MakePaletteColor(int colorCount)
        {
            if (MyOriginPixels == null)
            {
                return;
            }

            SelectType selecter = (SelectType)ComboBoxSelectType.SelectedItem;
            SplitType  splitter = (SplitType)ComboBoxSplitType.SelectedItem;
            var        cube     = new Cube(MyOriginPixels);

            cube.Split(colorCount, selecter, splitter);//分割数指定でCube分割

            //Cubeから色取得して、色データ作成
            List <Color> colors = cube.GetColors((ColorSelectType)ComboBoxColorSelectType.SelectedItem);
            ObservableCollection <MyData> data = MakeDataContext(colors);

            MyColorDataList.Add(colors);

            //色データ表示用のlistboxを作成して表示
            ListBox list = CreateListBox();

            list.DataContext = data;
            //MyStackPanel.Children.Add(list);
            MyStackPanel.Children.Add(MakePanelPalette(list, colors.Count));
        }
 public SelectInterfaceImplementation(GeneratorSettings settings, SelectType source, SelectType target)
 {
     _source  = source;
     _target  = target;
     _helper  = new NamedTypeHelper(source, settings);
     Settings = settings;
 }
예제 #27
0
        protected IEnumerable <EntityDefinition> GetAddedEntities(SelectType o, SelectType n)
        {
            var candidates = GetAddedTypes(o, n).OfType <EntityDefinition>().Select(c => c.Name).ToList();

            //find equivalents in old schema
            return(_matches.Where(m => m.Target != null && candidates.Any(c => c == m.Target.Name)).Select(m => m.Source));
        }
예제 #28
0
 private void OnSelected(SelectType selectType)
 {
     if (mOnArsenaltypeSelectListener != null)
     {
         mOnArsenaltypeSelectListener(selectType);
     }
 }
예제 #29
0
        public string SelectTypeString(SelectType data)
        {
            var constructors = new StringBuilder();

            foreach (var value in data.Values)
            {
                constructors.AppendLine($"\t\tpublic {data.Name}({value} value):base(value){{}}");
            }
            var result =
                $@"	/// <summary>
	/// http://www.buildingsmart-tech.org/ifc/IFC4/final/html/link/{data.Name.ToLower()}.htm
	/// </summary>
	[TypeConverter(typeof(SelectConverter<{data.Name}>))]
	public class {data.Name} : IfcSelect<{string.Join(",",data.Values)}>
	{{
{constructors}
		public static {data.Name} FromJSON(string json)
		{{
			return JsonConvert.DeserializeObject<{data.Name}>(json);
		}}
	}}
";

            return(result);
        }
예제 #30
0
        public List <LinkIDAttribute> getAttributes(String userId, String attributeName)
        {
            setTargetIdentity(userId);

            QueryType     query     = new QueryType();
            QueryItemType queryItem = new QueryItemType();

            queryItem.objectType = DataServiceConstants.ATTRIBUTE_OBJECT_TYPE;
            query.QueryItem      = new QueryItemType[] { queryItem };

            SelectType select = new SelectType();

            select.Value     = attributeName;
            queryItem.Select = select;

            QueryResponseType response = this.client.Query(query);

            validateStatus(response.Status);

            // parse attributes
            List <LinkIDAttribute> attributes = new List <LinkIDAttribute>();

            if (null != response.Data)
            {
                foreach (DataType data in response.Data)
                {
                    attributes.Add(getAttribute(data.Attribute));
                }
            }
            return(attributes);
        }
예제 #31
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (!IsExpland)
     {
         Rectangle imgRect = new Rectangle(0, 0, C_ImgHeight + 2, C_Height);
         if (imgRect.Contains(e.Location))
         {
             if (IsEnter != SelectType.ExplanSelect)
             {
                 IsEnter = SelectType.ExplanSelect;
                 Invalidate();
             }
         }
         else
         {
             if (IsEnter != SelectType.TextSelect)
             {
                 IsEnter = SelectType.TextSelect;
                 Invalidate();
             }
         }
     }
     else
     {
         if (IsEnter != SelectType.TextSelect)
         {
             IsEnter = SelectType.TextSelect;
             Invalidate();
         }
     }
 }
예제 #32
0
        public static Stream Select(SmartCard card, SelectType selectType, byte[] file, SelectFileOccurrence fileOccurrence, SelectFileControlInformation fileControlInformation, int expectedLength)
        {
            Command cmd = new Command();

            cmd.Instruction    = 0xA4;
            cmd.Parameter1     = (byte)selectType;
            cmd.Parameter2     = (byte)((byte)fileOccurrence | (byte)fileControlInformation);
            cmd.Data           = file;
            cmd.ResponseLength = expectedLength;
            byte[] command = cmd.ToArray();
            byte[] buffer  = new byte[256];
            //Console.Write("Sending command {0}...", BitConverter.ToString(command));
            int len = card.Transmit(command, buffer);
            //Console.WriteLine(BitConverter.ToString(buffer, 0, len));
            CommandStatus status = GetStatus(buffer, len);

            if (!status.IsNormal())
            {
                throw status.ToException();
            }
            Stream result = new MemoryStream();

            result.Write(buffer, 0, len - 2);
            while (status.Sw1 == 0x61)
            {
                throw new NotImplementedException("Reading of remaining length not implemented");
            }
            return(result);
        }
예제 #33
0
        public bool OrderSelect(int index, SelectType select, SelectModeType pool)
        {
            AsyncCommand aCmd = new AsyncCommand(Commands.OrderSelect,
                                                 new object[] { index, select, pool });

            ExecuteCommand(aCmd);
            return((bool)aCmd.Result);
        }
예제 #34
0
        /// <summary>
        /// Get the selected element, and check whether it is a wall, a floor or a beam.
        /// </summary>
        /// <returns>true if the process succeed; otherwise, false.</returns>
        Boolean GetSelectedElement()
        {
            // First get the selection, and make sure only one element in it.
            ElementSet collection = m_project.Selection.Elements;

            if (1 != collection.Size)
            {
                m_errorInformation =
                    "Please select only one element, such as a wall, a beam or a floor.";
                return(false);
            }

            // Get the selected element.
            foreach (Autodesk.Revit.DB.Element e in collection)
            {
                m_currentComponent = e;
            }

            // Make sure the element to be a wall, beam or a floor.
            if (m_currentComponent is Wall)
            {
                // Check whether the wall is a linear wall
                LocationCurve location = m_currentComponent.Location as LocationCurve;
                if (null == location)
                {
                    m_errorInformation = "The selected wall should be linear.";
                    return(false);
                }
                if (location.Curve is Line)
                {
                    m_type = SelectType.WALL;   // when the element is a linear wall
                    return(true);
                }
                else
                {
                    m_errorInformation = "The selected wall should be linear.";
                    return(false);
                }
            }

            FamilyInstance beam = m_currentComponent as FamilyInstance;

            if (null != beam && StructuralType.Beam == beam.StructuralType)
            {
                m_type = SelectType.BEAM;       // when the element is a beam
                return(true);
            }

            if (m_currentComponent is Floor)
            {
                m_type = SelectType.FLOOR;      // when the element is a floor.
                return(true);
            }

            // If it is not a wall, a beam or a floor, give error information.
            m_errorInformation = "Please select an element, such as a wall, a beam or a floor.";
            return(false);
        }
예제 #35
0
        public static bool ChangeModGroup(this ModManager manager, string oldGroupName, string newGroupName, ModData mod,
                                          SelectType type = SelectType.Single)
        {
            if (newGroupName == oldGroupName || mod.Meta.Groups.ContainsKey(newGroupName))
            {
                return(false);
            }

            if (mod.Meta.Groups.TryGetValue(oldGroupName, out var oldGroup))
            {
                if (newGroupName.Length > 0)
                {
                    mod.Meta.Groups[newGroupName] = new OptionGroup()
                    {
                        GroupName     = newGroupName,
                        SelectionType = oldGroup.SelectionType,
                        Options       = oldGroup.Options,
                    };
                }

                mod.Meta.Groups.Remove(oldGroupName);
            }
            else
            {
                if (newGroupName.Length == 0)
                {
                    return(false);
                }

                mod.Meta.Groups[newGroupName] = new OptionGroup()
                {
                    GroupName     = newGroupName,
                    SelectionType = type,
                    Options       = new List <Option>(),
                };
            }

            mod.SaveMeta();

            foreach (var collection in manager.Collections.Collections.Values)
            {
                if (!collection.Settings.TryGetValue(mod.BasePath.Name, out var settings))
                {
                    continue;
                }

                if (newGroupName.Length > 0)
                {
                    settings.Settings[newGroupName] = settings.Settings.TryGetValue(oldGroupName, out var value) ? value : 0;
                }

                settings.Settings.Remove(oldGroupName);
                collection.Save();
            }

            return(true);
        }
예제 #36
0
파일: LeanSelect.cs 프로젝트: Diogo45/AR
        private void TryGetComponent(SelectType selectUsing, Vector2 screenPosition, ref Component component)
        {
            switch (selectUsing)
            {
            case SelectType.Raycast3D:
            {
                // Make sure the camera exists
                var camera = LeanTouch.GetCamera(Camera, gameObject);

                if (camera != null)
                {
                    var ray = camera.ScreenPointToRay(screenPosition);
                    var hit = default(RaycastHit);

                    if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
                    {
                        Debug.Log("acertou");
                        component = hit.collider;
                    }
                }
                else
                {
                    Debug.LogError("Failed to find camera. Either tag your cameras MainCamera, or set one in this component.", this);
                }
            }
            break;

            case SelectType.Overlap2D:
            {
                // Make sure the camera exists
                var camera = LeanTouch.GetCamera(Camera, gameObject);

                if (camera != null)
                {
                    var point = camera.ScreenToWorldPoint(screenPosition);

                    component = Physics2D.OverlapPoint(point, LayerMask);
                }
                else
                {
                    Debug.LogError("Failed to find camera. Either tag your cameras MainCamera, or set one in this component.", this);
                }
            }
            break;

            case SelectType.CanvasUI:
            {
                var results = LeanTouch.RaycastGui(screenPosition, LayerMask);

                if (results != null && results.Count > 0)
                {
                    component = results[0].gameObject.transform;
                }
            }
            break;
            }
        }
예제 #37
0
    private void GenerateTilesBasedOnSelectType(SelectType selectType, int limit)
    {
        MapPosition pos = selected.MapPosition;

        ActionBasedOnSelectType(selectType,
                                SetMeleeTiles,
                                () => SetLineTiles(pos, limit),
                                () => targetableTiles = RadiusManager.Instance.GetRadius(pos, limit));
    }
 public StudInterviewDataReportForm(SelectType type)
 {
     InitializeComponent();
     _UDTTransfer = new UDTTransfer();
     _studIDList = new List<string>();
     _TeacherIDList = new List<string>();
     _studDataDict = new Dictionary<string, StudentRecord>();
     _bgWorker= new BackgroundWorker ();
     _dataDictList= new List<Dictionary<string,string>>();
     _UserSelectType = type;
     _bgWorker.DoWork+=new DoWorkEventHandler(_bgWorker_DoWork);
     _bgWorker.RunWorkerCompleted+=new RunWorkerCompletedEventHandler(_bgWorker_RunWorkerCompleted);
 }
예제 #39
0
		public static Stream Select(SmartCard card, SelectType selectType, byte[] file, SelectFileOccurrence fileOccurrence, SelectFileControlInformation fileControlInformation, int expectedLength) {
			Command cmd = new Command();
			cmd.Instruction = 0xA4;
			cmd.Parameter1 = (byte)selectType;
			cmd.Parameter2 = (byte)((byte)fileOccurrence | (byte)fileControlInformation);
			cmd.Data = file;
			cmd.ResponseLength = expectedLength;
			byte[] command = cmd.ToArray();
			byte[] buffer = new byte[256];
			//Console.Write("Sending command {0}...", BitConverter.ToString(command));
			int len = card.Transmit(command, buffer);
			//Console.WriteLine(BitConverter.ToString(buffer, 0, len));
			CommandStatus status = GetStatus(buffer, len);
			if (!status.IsNormal())
				throw status.ToException();
			Stream result = new MemoryStream();
			result.Write(buffer, 0, len - 2);
			while (status.Sw1 == 0x61) {
				throw new NotImplementedException("Reading of remaining length not implemented");
			}
			return result;
		}
예제 #40
0
 public SelectAttribute(string valueMember = "", SelectType type = SelectType.Single)
 {
     Type = type;
     ValueMember = valueMember;
 }
예제 #41
0
        public void DrawMainWindow(int WindowID)
        {
            string errLine = "1";
            try
            {
                thisSkin.label.fontStyle = FontStyle.Bold;
                GUI.Label(new Rect(10, 5, 100, 20), "Description", thisSkin.label);
                GUI.Label(new Rect(110, 5, 100, 20), "Mod", thisSkin.label);
                //GUI.Label(new Rect(210, 5, 100, 20), "Action Type", thisSkin.label); //moved other stuff 50 pixels
                thisSkin.label.fontStyle = FontStyle.Normal;
                errLine = "2";
                if (GUI.Button(new Rect(250, 5, 100, 20), "Clear Selection", thisSkin.button))
                {
                    SetPart(null);
                    selectingParts = null;
                    selectingPartsName = null;
                }
                if (includeSymmetryParts)
                {
                    thisSkin.button.normal.background = buttonGreen;
                    thisSkin.button.hover.background = buttonGreen;
                }
                else
                {
                    thisSkin.button.normal.background = buttonRed;
                    thisSkin.button.hover.background = buttonRed;
                }
                errLine = "3";

                if (GUI.Button(new Rect(350, 5, 100, 20), includeSymmetryParts ? "Symmetry: Yes" : "Symmetry: No", thisSkin.button))
                {
                    includeSymmetryParts = !includeSymmetryParts;
                }
                thisSkin.button.normal.background = buttonGray;
                thisSkin.button.hover.background = buttonGray;
                errLine = "4";

                if (copyMode)
                {
                    thisSkin.button.normal.background = buttonRed;
                    thisSkin.button.hover.background = buttonRed;
                }

                errLine = "4a";
                if (GUI.Button(new Rect(450, 5, 80, 20), copyMode ? "Copying" : "Copy?", thisSkin.button))
                {
                    if(!copyMode)
                    {
                        copyPart = selectedPart;
                        copyMode = true;
                    }
                    else
                    {
                        copyPart = null;
                        copyMode = false;
                    }
                }
                thisSkin.button.normal.background = buttonGray;
                thisSkin.button.hover.background = buttonGray;

                MainWinScroll = GUI.BeginScrollView(new Rect(5, 25, 520, 105), MainWinScroll, new Rect(0, 0, 500, 600));

                if (selType == SelectType.NoPart)
                {

                    errLine = "5";
                    GUI.Label(new Rect(5, 5, 500, 20), "Select a part on the vessel, or a mod below to see its associated parts:", thisSkin.label);
                    if (allModNames.Count > 0)
                    {
                        for (int iVert = 1; iVert <= 20; iVert++)
                        {
                            for (int iHoriz = 1; iHoriz <= 5; iHoriz++)
                            {
                                int buttonCount = iHoriz + ((iVert - 1) * 5);
                                if (allModNames.ElementAt(buttonCount - 1) == selectingPartsName)
                                {
                                    thisSkin.button.normal.background = buttonGreen;
                                    thisSkin.button.hover.background = buttonGreen;
                                }
                                else
                                {
                                    thisSkin.button.normal.background = buttonGray;
                                    thisSkin.button.hover.background = buttonGray;
                                }
                                if (GUI.Button(new Rect((iHoriz - 1) * 100, (iVert) * 20, 100, 20), allModNames.ElementAt(buttonCount - 1), thisSkin.button))
                                {
                                    selectingParts = StaticMethods.AllActionsList.Where(md => md.Name == allModNames.ElementAt(buttonCount - 1)).First().ModuleName;
                                    selectingPartsName = allModNames.ElementAt(buttonCount - 1);
                                }
                                thisSkin.button.normal.background = buttonGray;
                                thisSkin.button.hover.background = buttonGray;

                                if (buttonCount == allModNames.Count())
                                {
                                    goto Breakout; //all buttons drawn, need to breakout of the loop
                                }
                            }
                        }
                    }
                    else
                    {
                        GUI.Label(new Rect(5, 35, 500, 20), "Critial error, no actions loaded.", thisSkin.label);
                        GUI.Label(new Rect(5, 65, 500, 20), "Check your installation path and/or file a bug report.", thisSkin.label);
                    }

                }
                else if (selType == SelectType.None) //display our actions list
                {
                    errLine = "6";
                    //Debug.Log("1");
                    for (int i = 1; i <= 30; i++)
                    {
                        errLine = "6a " + i;
                        // Debug.Log("2");
                        GUI.Label(new Rect(0, 1 + (20 * (i - 1)), 20, 20), i.ToString() + ":", thisSkin.label);
                        //Debug.Log("3");
                        if (dataPM.modActionsList.ContainsKey(i))
                        {
                            errLine = "6b";
                            //  Debug.Log("4:" + i + dataPM.modActionsList[i].Description);
                            dataPM.modActionsList[i].Description = GUI.TextField(new Rect(21, 1 + (20 * (i - 1)), 80, 20), dataPM.modActionsList[i].Description, thisSkin.textField);
                            //.Log("5");
                            if (GUI.Button(new Rect(100, 0 + (20 * (i - 1)), 100, 20), dataPM.modActionsList[i].Name, thisSkin.button))
                            {
                                errLine = "6c";
                                //Debug.Log("6");
                                selectingID = i;
                                selType = SelectType.Name;
                                savedScrollLocation = MainWinScroll;
                                MainWinScroll = new Vector2(0, 0);
                            }
                            if (GUI.Button(new Rect(200, 0 + (20 * (i - 1)), 100, 20), dataPM.modActionsList[i].ActionGroup, thisSkin.button))
                            {
                                errLine = "6d";
                                //Debug.Log("6");
                                selectingID = i;
                                selType = SelectType.ActionGroup;
                                actionGroupNames.Clear();
                                foreach (ModActionData md in StaticMethods.AllActionsList.Where(d => d.Name == dataPM.modActionsList[i].Name))
                                {
                                    if (!actionGroupNames.Contains(md.ActionGroup))
                                    {
                                        actionGroupNames.Add(md.ActionGroup);
                                    }
                                }
                                savedScrollLocation = MainWinScroll;
                                MainWinScroll = new Vector2(0, 0);
                            }
                            if (GUI.Button(new Rect(300, 0 + (20 * (i - 1)), 100, 20), dataPM.modActionsList[i].ActionActual, thisSkin.button))
                            {
                                errLine = "6e";
                                //Debug.Log("6");
                                selectingID = i;
                                selType = SelectType.ActionActual;
                                actionGroupNames.Clear();
                                foreach (ModActionData md in StaticMethods.AllActionsList.Where(d => d.Name == dataPM.modActionsList[i].Name && d.ActionGroup == dataPM.modActionsList[i].ActionGroup))
                                {
                                    if (!actionGroupNames.Contains(md.ActionActual))
                                    {
                                        actionGroupNames.Add(md.ActionActual);
                                    }
                                }
                                //Debug.Log("count " + actionGroupNames.Count);
                                savedScrollLocation = MainWinScroll;
                                MainWinScroll = new Vector2(0, 0);
                            }
                            Color GUIbackup = GUI.backgroundColor;
                            if (dataPM.modActionsList[i].ActionDataType == "no")
                            {
                                errLine = "6f";//leave blank as we show nothing if this colum stays blank
                            }
                            else if (dataPM.modActionsList[i].ActionDataType == "float")
                            {
                                errLine = "6g";
                                float tempVal;
                                //Color GUIbackup = GUI.backgroundColor;
                                if (float.TryParse(dataPM.modActionsList[i].ActionValue, out tempVal))
                                {
                                    //blank, do nothing
                                }
                                else
                                {
                                    GUI.backgroundColor = new Color(1, 0, 0);
                                }
                            }
                            else if (dataPM.modActionsList[i].ActionDataType == "int")
                            {
                                errLine = "6g";
                                int tempVal;
                                //Color GUIbackup = GUI.backgroundColor;
                                if (int.TryParse(dataPM.modActionsList[i].ActionValue, out tempVal))
                                {
                                    //blank, do nothing
                                }
                                else
                                {
                                    GUI.backgroundColor = new Color(1, 0, 0);
                                }
                            }

                            if (dataPM.modActionsList[i].ActionDataType != "no")
                            {
                                string origString = string.Copy(dataPM.modActionsList[i].ActionValue);
                                dataPM.modActionsList[i].ActionValue = GUI.TextField(new Rect(400, 0 + (20 * (i - 1)), 100, 20), dataPM.modActionsList[i].ActionValue, thisSkin.textField);
                                GUI.backgroundColor = GUIbackup;
                                if (origString != dataPM.modActionsList[i].ActionValue)
                                {
                                    SyncSymmetry(dataPM.part, dataPM.modActionsList[i], i);
                                }
                            }
                            //Debug.Log("7");
                        }
                        else
                        {

                            errLine = "6h";
                            if (GUI.Button(new Rect(101, 1 + (20 * (i - 1)), 100, 20), "Click to select", thisSkin.button))
                            {
                                selectingID = i;
                                selType = SelectType.Name;
                                savedScrollLocation = MainWinScroll;
                                MainWinScroll = new Vector2(0, 0);
                            }
                        }
                    }
                }

                else if (selType == SelectType.Name)
                {

                    errLine = "7";
                    for (int iVert = 1; iVert <= 20; iVert++)
                    {
                        for (int iHoriz = 1; iHoriz <= 5; iHoriz++)
                        {
                            int buttonCount = iHoriz + ((iVert - 1) * 5);
                            if (GUI.Button(new Rect((iHoriz - 1) * 100, (iVert - 1) * 20, 100, 20), modNames.ElementAt(buttonCount - 1), thisSkin.button))
                            {
                                SelectModName(modNames.ElementAt(buttonCount - 1), selectingID);
                                MainWinScroll = savedScrollLocation;
                            }
                            if (buttonCount == modNames.Count())
                            {
                                goto Breakout; //all buttons drawn, need to breakout of the loop
                            }
                        }
                    }
                }
                else if (selType == SelectType.ActionGroup) //copied code not yet updated
                {
                    errLine = "8";
                    for (int iVert = 1; iVert <= actionGroupNames.Count; iVert++)
                    {
                        if (GUI.Button(new Rect(200, (iVert - 1) * 20, 100, 20), actionGroupNames.ElementAt(iVert - 1), thisSkin.button))
                        {
                            SelectActionName(dataPM.modActionsList[selectingID].Name, actionGroupNames.ElementAt(iVert - 1), selectingID);
                            MainWinScroll = savedScrollLocation;
                        }
                    }
                }
                else if (selType == SelectType.ActionActual) //copied code not yet updated
                {
                    errLine = "9";
                    for (int iVert = 1; iVert <= actionGroupNames.Count; iVert++)
                    {
                        if (GUI.Button(new Rect(300, (iVert - 1) * 20, 100, 20), actionGroupNames.ElementAt(iVert - 1), thisSkin.button))
                        {
                            SelectActionType(actionGroupNames.ElementAt(iVert - 1), selectingID);
                            MainWinScroll = savedScrollLocation;
                        }
                    }
                }
                errLine = "10";
            Breakout:
                errLine = "11";
                GUI.EndScrollView();
                GUI.DragWindow();
            }
            catch (Exception e)
            {
                Debug.Log("ModActs DrawWin Fail " + errLine + " " + e);
            }
        }
예제 #42
0
        //called from Flight or Editor KSPAddons when selected part changes.
        public void SetPart(Part p)
        {
            selectedPart = p;

            if (selectedPart != null)
            {

                dataPM = p.Modules.OfType<ModuleModActions>().First();
                RefreshModNames(true);
                if(copyMode && copyPart != null)
                {
                    dataPM.modActionsList.Clear();
                    ModuleModActions copySource = (ModuleModActions) copyPart.Modules["ModuleModActions"];
                    foreach(KeyValuePair<int,ModActionData> kvp in copySource.modActionsList)
                    {
                        if (dataPM.part.Modules.Contains(kvp.Value.ModuleName))
                        {
                            dataPM.modActionsList.Add(kvp.Key, new ModActionData(kvp.Value));
                        }
                    }
                    if(includeSymmetryParts)
                    {
                        foreach(Part p3 in dataPM.part.symmetryCounterparts)
                        {
                            ModuleModActions symDataPM = (ModuleModActions)p3.Modules["ModuleModActions"];
                            symDataPM.modActionsList.Clear();
                            foreach (KeyValuePair<int, ModActionData> kvp in copySource.modActionsList)
                            {
                                if (symDataPM.part.Modules.Contains(kvp.Value.ModuleName))
                                {
                                    symDataPM.modActionsList.Add(kvp.Key, new ModActionData(kvp.Value));
                                }
                            }
                        }
                    }
                }
                copyMode = false;
                copyPart = null;
                selType = SelectType.None;
            }
            else
            {

                dataPM = null;
                RefreshModNames(false);
                selType = SelectType.NoPart;
            }
        }
예제 #43
0
 public CardSelector(int cardId)
 {
     _type = SelectType.Id;
     _id = cardId;
 }
예제 #44
0
 public CardSelector(CardLocation location)
 {
     _type = SelectType.Location;
     _location = location;
 }
예제 #45
0
 public CardSelector(IList<int> ids)
 {
     _type = SelectType.Ids;
     _ids = ids;
 }
예제 #46
0
	void Start()
	{		
		// Divide with 1280x720, as the values are made for it. Can be adapted to 1920x1080 with values
		// above, but hell no.. not yet, fiddlediddle way too much
		infoHubRect = new Rect ((0.0f / 1280.0f) * resX, (520.0f / 720.0f) * resY, (160.0f / 1280.0f) * resX, (200.0f / 720.0f) * resY);
		toolBarRect = new Rect ((170.0f / 1280.0f) * resX, (630.0f / 720.0f) * resY, (480.0f / 1280.0f) * resX, (80.0f / 720.0f) * resY);
		mainMenuRect = new Rect ((320.0f / 1280.0f) * resX, (80.0f / 720.0f) * resY, (640.0f / 1280.0f) * resX, (400.0f / 720.0f) * resY);
		targetInfoRect = new Rect ((1040.0f / 1280.0f) * resX, (80.0f / 720.0f) * resY, (160.0f / 1280.0f) * resX, (400.0f / 720.0f) * resY);
		pauseMenuRect = new Rect ((560.0f / 1280.0f) * resX, (160.0f / 720.0f) * resY, (160.0f / 1280.0f) * resX, (400.0f / 720.0f) * resY);


		btn1 = new Rect (5, 20, 70, 45);
		btn2 = new Rect (80, 20, 70, 45);
		btn3 = new Rect (155, 20, 70, 45);

		windowOpen = Window.none;
		selectedType = SelectType.none;
		//SetCursorState(CursorState.Select);
		//Screen.showCursor = false;
	}
예제 #47
-1
 public ScaffoldSelectPropertiesAttribute(string valueMember, SelectType type = SelectType.Single)
 {
     Type = type;
     ValueMember = valueMember;
 }
예제 #48
-1
        //click on second column
        public void SelectModName(String mName, int selID)
        {
            if (mName == "Clear Action") //delete this action
            {
                dataPM.modActionsList.Remove(selID); //delete it
                dataPM.Actions.Find(ba => ba.name == "Action" + selID.ToString()).active = false; //hide the action from the GUI
                UpdateCheck();
            }
            else //select new action
            {
                List<ModActionData> listToAdd = new List<ModActionData>();
                listToAdd.AddRange(StaticMethods.AllActionsList.Where(item => item.Name == mName)); //find all ModActionData for this mod
                if (dataPM.modActionsList.ContainsKey(selID)) //if action already exists, overwrite it
                {

                    dataPM.modActionsList.Remove(selID);
                }
                dataPM.modActionsList.Add(selID, new ModActionData(listToAdd.OrderBy(dt => dt.Identifier).First()));
                dataPM.modActionsList[selID].Description = dataPM.modActionsList[selID].ActionActual;//add the new action
                dataPM.Actions.Find(ba => ba.name == "Action" + selID.ToString()).active = true; //action should now show
                UpdateCheck();
                //dataPM.Actions.Find(ba => ba.name == "Action" + selID.ToString()).guiName = dataPM.modActionsList[selID].Description; //guiName will update later
            }
            //action is selected, return our window to showing the actions list
            selectingID = 0; //should never be check when SelectType.None is true
            selType = SelectType.None;
        }
예제 #49
-1
        //click on second column
        public void SelectActionType(string aGroup, int selID)
        {
            List<ModActionData> listToAdd = new List<ModActionData>();
            listToAdd.AddRange(StaticMethods.AllActionsList.Where(item => item.Name == dataPM.modActionsList[selID].Name && item.ActionGroup == dataPM.modActionsList[selID].ActionGroup && item.ActionActual == aGroup)); //find all ModActionData for this mod
            if (dataPM.modActionsList.ContainsKey(selID)) //if action already exists, overwrite it
            {
                dataPM.modActionsList.Remove(selID);
            }
            dataPM.modActionsList.Add(selID, new ModActionData(listToAdd.OrderBy(dt => dt.Identifier).First()));
            dataPM.modActionsList[selID].Description = dataPM.modActionsList[selID].ActionActual;//add the new action
            dataPM.Actions.Find(ba => ba.name == "Action" + selID.ToString()).active = true; //action should now show
            UpdateCheck();
            // dataPM.Actions.Find(ba => ba.name == "Action" + selID.ToString()).guiName = dataPM.modActionsList[selID].Description; //UpdateCheck does this
            //Debug.Log(dataPM.modActionsList[selID].ToString());

            //action is selected, return our window to showing the actions list
            selectingID = 0; //should never be check when SelectType.None is true
            selType = SelectType.None;
            MainWinScroll = savedScrollLocation;
        }
예제 #50
-1
 //effectively our Start() method
 public MainGUIWindow(List<Part> prts, float winTop, float winLeft)
 {
     savedScrollLocation = new Vector2(0, 0);
     RenderingManager.AddToPostDrawQueue(5, ModActsDraw);
     MainWindowRect = new Rect(winLeft, winTop, 530, 135);
     parts = prts;
     modNames = new List<String>();
     actionGroupNames = new List<string>();
     partLoc = new Texture2D(21, 21);
     //partLoc = GameDatabase.Instance.databaseTexture.Find(tx => tx.name == "PartLocCircle").texture;
     partLoc = GameDatabase.Instance.GetTexture("Diazo/ModActions/PartLocCircle", false);
     buttonGray = GameDatabase.Instance.GetTexture("Diazo/ModActions/ButtonTexture", false);
     buttonRed = GameDatabase.Instance.GetTexture("Diazo/ModActions/ButtonTextureRed", false);
     buttonGreen = GameDatabase.Instance.GetTexture("Diazo/ModActions/ButtonTextureGreen", false);
     thisSkin = (GUISkin)MonoBehaviour.Instantiate(HighLogic.Skin);
     thisSkin.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font;
     thisSkin.label.fontStyle = FontStyle.Normal;
     thisSkin.label.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
     thisSkin.scrollView.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
     thisSkin.label.alignment = TextAnchor.MiddleCenter;
     thisSkin.button.normal.background = buttonGray;
     thisSkin.button.hover.background = buttonGray;
     thisSkin.button.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
     thisSkin.button.hover.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
     thisSkin.button.fontStyle = FontStyle.Normal;
     thisSkin.textField.fontStyle = FontStyle.Normal;
     thisSkin.textField.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
     thisSkin.textField.hover.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
     MainWinScroll = new Vector2(0, 0);
     allModNames = new List<string>();
     foreach (ModActionData mData in StaticMethods.AllActionsList)
     {
         if (!allModNames.Contains(mData.Name))
         {
             allModNames.Add(mData.Name);
         }
     }
     allModNames.Sort();
     if (HighLogic.LoadedSceneIsEditor)
     {
         cameraPos = EditorLogic.fetch.editorCamera;
     }
     else
     {
         cameraPos = FlightCamera.fetch.mainCamera;
     }
     selType = SelectType.NoPart;
     //Debug.Log("init okay");
 }
예제 #51
-1
파일: Command.cs 프로젝트: AMEE/revit
        /// <summary>
        /// Get the selected element, and check whether it is a wall, a floor or a beam.
        /// </summary>
        /// <returns>true if the process succeed; otherwise, false.</returns>
        Boolean GetSelectedElement()
        {
            // First get the selection, and make sure only one element in it.
            ElementSet collection = m_project.Selection.Elements;
            if (1 != collection.Size)
            {
                m_errorInformation =
                    "Please select only one element, such as a wall, a beam or a floor.";
                return false;
            }

            // Get the selected element.
            foreach (Autodesk.Revit.DB.Element e in collection)
            {
                m_currentComponent = e;
            }

            // Make sure the element to be a wall, beam or a floor.
            if (m_currentComponent is Wall)
            {
                // Check whether the wall is a linear wall
                LocationCurve location = m_currentComponent.Location as LocationCurve;
                if (null == location)
                {
                    m_errorInformation = "The selected wall should be linear.";
                    return false;
                }
                if (location.Curve is Line)
                {
                    m_type = SelectType.WALL;   // when the element is a linear wall
                    return true;
                }
                else
                {
                    m_errorInformation = "The selected wall should be linear.";
                    return false;
                }
            }

            FamilyInstance beam = m_currentComponent as FamilyInstance;
            if (null != beam && StructuralType.Beam == beam.StructuralType)
            {
                m_type = SelectType.BEAM;       // when the element is a beam
                return true;
            }

            if (m_currentComponent is Floor)
            {
                m_type = SelectType.FLOOR;      // when the element is a floor.
                return true;
            }

            // If it is not a wall, a beam or a floor, give error information.
            m_errorInformation = "Please select an element, such as a wall, a beam or a floor.";
            return false;
        }
예제 #52
-1
파일: Command.cs 프로젝트: AMEE/revit
        SelectType m_type; // Indicate the type of the selected element.

        #endregion Fields

        #region Constructors

        // Methods
        /// <summary>
        /// Default constructor of Command
        /// </summary>
        public Command()
        {
            m_type = SelectType.INVALID;
        }
예제 #53
-2
        /// <summary>
        /// Initializes a new instance of the <see cref="Nancy.Scaffolding.ScaffoldObjectList"/> class.
        /// </summary>
        /// <param name="listContainer">The type that contains the list of objects.</param>
        /// <param name="objectType">The list type of objects.</param>
        /// <param name="property">Property that returns the list.</param>
        /// <param name="valueMember">Value member of object which will be displayed.</param>
        /// <param name="selectType">Select type.</param>
        public ObjectListAttribute(Type listContainer, Type objectType, string methodName, string valueMember, SelectType selectType = SelectType.Single)
        {
            //            if (!objectType.IsAssignableFrom (typeof(IObjectList))) {
            //                throw new ArgumentException ("type", "The type parameter must be of type IObjectList.");
            //            }
            var member = listContainer.GetMethod(methodName, BindingFlags.Public | BindingFlags.Static);

            if (member == null)
            {
                throw new ArgumentException("methodName", string.Format("There is no method {0} in type {1}.",
                                                                      methodName, listContainer.Name));
            }

            //            if (!member.GetGetMethod().ReturnType.IsAssignableFrom(objectType))
            //            {
            //                throw new ArgumentException("property", string.Format("The property {0} must return the type IEnumerable<{1}>.",
            //                                                                      memberName, objectType.Name));
            //            }

            if (listContainer.IsStatic())
            {
                GetList = member.Invoke(null, null) as IEnumerable<object>;
            }
            else
            {
                var ctor = listContainer.GetConstructor(BindingFlags.Public, null, null, null);
                var ctors = listContainer.GetConstructors();

                if (ctors.Length == 0 || ctor == null)
                {
                    throw new ArgumentException("listType", string.Format("The type {0} must have a puclic constructor.",
                                                                                       listContainer.Name));
                }

                var obj = Activator.CreateInstance(listContainer);
                GetList = member.Invoke(obj, null) as IEnumerable<object>;
            }

            SelectType = selectType;
            ValueMember = valueMember;
            ObjectType = objectType;
        }
예제 #54
-2
 public CardSelector(ClientCard card)
 {
     _type = SelectType.Card;
     _card = card;
 }