Пример #1
0
        TeeBase.Info.Type TeeTypeField(TeeBase.Info.Type index, int holeIndex, bool add, float xBoxes)
        {
            string[] names     = CourseBase.FreeTees(holeIndex);
            string   indexName = index.ToString();

            if (!ArrayUtility.Contains(names, indexName))
            {
                if (add)
                {
                    ArrayUtility.Add(ref names, indexName);

                    string[] newNames = System.Enum.GetNames(typeof(TeeBase.Info.Type));
                    for (int i = 0; i < newNames.Length; ++i)
                    {
                        if (!ArrayUtility.Contains(names, newNames[i]))
                        {
                            ArrayUtility.RemoveAt(ref newNames, i);
                            i = -1;
                            continue;
                        }
                    }
                    names = newNames;
                }
                else
                {
                    string[] newNames = System.Enum.GetNames(typeof(TeeBase.Info.Type));
                    for (int i = 0; i < newNames.Length; ++i)
                    {
                        if (!ArrayUtility.Contains(names, newNames[i]))
                        {
                            ArrayUtility.RemoveAt(ref newNames, i);
                            i = -1;
                            continue;
                        }
                    }
                    names     = newNames;
                    indexName = names[0];
                }
            }

            int namesIndex = ArrayUtility.IndexOf(names, indexName);

            namesIndex = Popup("Type", namesIndex, names, xBoxes);
            index      = (TeeBase.Info.Type)System.Enum.Parse(typeof(TeeBase.Info.Type), names[namesIndex]);

            return(index);
            //return Iloveyou;
        }
Пример #2
0
 /// Get name for the tee
 /// </summary>
 /// <param name="holeIndex"></param>
 /// <param name="type"></param>
 /// <param name="par"></param>
 /// <param name="strokeIndex"></param>
 /// <returns></returns>
 public static string GetTeeName(int holeIndex, TeeBase.Info.Type type, TeeBase.Info.Par par, int strokeIndex)
 {
     return("H" + (holeIndex + 1) + "\\" + type.ToString() + " PAR" + par.ToString().Replace("_", "") + " S" + strokeIndex.ToString());
 }