Exemplo n.º 1
0
        public static SelectChoice getSelect(string temp)
        {
            string       connectionString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
            SelectChoice model            = new SelectChoice();

            model.institution_name = new List <string>();
            model.module_name      = new List <Module>();
            model.line_chart       = new List <Chart>();
            institution_id_list    = new List <int>();
            using (SqlConnection cn = new SqlConnection(connectionString))
            {
                SqlDataReader dr  = null;
                SqlCommand    cmd = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "EXEC Eval.Diagnostics_LoadModules;";
                cn.Open();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Module mod = new Module();
                    mod.name = (dr["Diagnostic_Module_Name"].ToString());
                    mod.id   = dr.GetInt32(0);
                    model.module_name.Add(mod);
                }
                dr.Close();

                SqlDataReader dr1 = null;
                cmd.CommandText = "EXEC Eval.GetInstitutions;";
                dr1             = cmd.ExecuteReader();
                while (dr1.Read())
                {
                    model.institution_name.Add(dr1["Institution_Name"].ToString());
                    institution_id_list.Add(Convert.ToInt32(dr1["MPOG_Institution_ID"].ToString()));
                }
                dr1.Close();

                SqlDataReader dr2 = null;
                cmd.CommandText = "EXEC Eval.Diagnostics_LoadLineCharts;";
                dr2             = cmd.ExecuteReader();
                int id = model.module_name[0].id;
                while (dr2.Read())
                {
                    Chart chart_var = new Chart();
                    int   mod_id    = Convert.ToInt32(dr2["Diagnostic_Module_ID"].ToString());
                    chart_var.display_name  = dr2["Short_Display_Name"].ToString();
                    chart_var.module_id     = mod_id;
                    chart_var.line_chart_id = dr2.GetInt32(0);
                    model.line_chart.Add(chart_var);
                }
                dr2.Close();
                cn.Close();
            }
            return(model);
        }
 public MultiplayerScreen()
     : base()
 {
     this.RequireDrawFocus = true;
     Messenger             = new List <string>();
     Message            = "";
     MessageDraw        = "";
     MessageStartIndex  = 0;
     MessageCursorIndex = 0;
     SelectedChoice     = SelectChoice.PlayerList;
     PlayerIndex        = -1;
     Stage             = -1;
     PlayerOptionIndex = -1;
     CurrentMap        = 0;
 }
Exemplo n.º 3
0
        private static Selection getSelection(String choiceValue, QuestionDef q)
        {
            Selection s;

            if (q == null || q.getDynamicChoices() != null)
            {
                s = new Selection(choiceValue);
            }
            else
            {
                SelectChoice choice = q.getChoiceForValue(choiceValue);
                s = (choice != null ? choice.selection() : null);
            }

            return(s);
        }
Exemplo n.º 4
0
 private void LerpToSpot(SelectChoice mySP)
 {
     if (mySP == SelectChoice.Ops)
     {
         //transform.position = Vector3.Lerp(transform.position, new Vector3(-256, transform.position.y, transform.position.z), 8 * Time.deltaTime);
         transform.position = new Vector3(transform.position.x, 55f, transform.position.z);
     }
     else if (mySP == SelectChoice.None)
     {
         //transform.position = Vector3.Lerp(transform.position, new Vector3(0, transform.position.y, transform.position.z), 8 * Time.deltaTime);
         transform.position = new Vector3(transform.position.x, -27, transform.position.z);
     }
     else
     {
         //transform.position = Vector3.Lerp(transform.position, new Vector3(256, transform.position.y, transform.position.z), 8 * Time.deltaTime);
         transform.position = new Vector3(transform.position.x, -108f, transform.position.z);
     }
 }
Exemplo n.º 5
0
    void Start()
    {
        Position = SelectChoice.None;
        mySM     = GameObject.Find("Managers").GetComponent <SelectionManager>();
        if (gameObject.name == "Controller1")
        {
            myNum = 0;
        }
        else
        {
            myNum = 1;
        }

        mySM.UpdateSelection(Position, myNum);

        gameObject.AddComponent <ControllerAdapter>();
        myCA = GetComponent <ControllerAdapter>();
        //Debug.Log(gameObject.name + " run Initialize for " + myNum);
        myCA.Initialize(myNum);
        GameStateManager.onSetControls  += SetControllerAdapter;
        GameStateManager.onPreLoadLevel += UnSub;
    }
    public void UpdateSelection(SelectChoice mySC, int pNum)
    {
        if (pNum == 0)
        {
            if (mySC != C1Select)
            {
                c1Confirm = false;
            }
            C1Select = mySC;
        }

        if (pNum == 1)
        {
            if (mySC != C2Select)
            {
                c2Confirm = false;
            }
            C2Select = mySC;
        }

        ControllerColor();
        NameColor();
    }
        public override void Update(GameTime gameTime)
        {
            if (CursorAlphaAppearing)
            {//Increment SelectedAlpha before comparing it to 200
                CursorAlpha += 5;
                if (CursorAlpha >= 200)
                {
                    CursorAlphaAppearing = false;
                }
            }
            else
            {//Decrement SelectedAlpha before comparing it to 55
                CursorAlpha -= 5;
                if (CursorAlpha <= 55)
                {
                    CursorAlphaAppearing = true;
                }
            }

            #region Stage == -1
            if (Stage == -1)
            {
                if (KeyboardHelper.InputUpPressed())
                {
                    if ((int)SelectedChoice < 2)
                    {
                        SelectedChoice -= (int)SelectedChoice > 0 ? 1 : 0;
                    }
                    else if ((int)SelectedChoice < 4)
                    {
                        SelectedChoice -= (int)SelectedChoice > 2 ? 1 : 0;
                    }
                }
                else if (KeyboardHelper.InputDownPressed())
                {
                    if ((int)SelectedChoice < 2)
                    {
                        SelectedChoice += (int)SelectedChoice < 1 ? 1 : 0;
                    }
                    else if ((int)SelectedChoice < 4)
                    {
                        SelectedChoice += (int)SelectedChoice < 3 ? 1 : 0;
                    }
                }
                if (KeyboardHelper.InputLeftPressed() && (int)SelectedChoice >= 2)
                {
                    SelectedChoice = SelectChoice.PlayerList;
                }
                else if (KeyboardHelper.InputRightPressed() && (int)SelectedChoice < 2)
                {
                    SelectedChoice = SelectChoice.ChangeMap;
                }
                else if (KeyboardHelper.InputConfirmPressed())
                {
                    switch (SelectedChoice)
                    {
                    case SelectChoice.PlayerList:
                        PlayerIndex = 0;
                        break;

                    case SelectChoice.ChangeMap:
                        CursorMap = CurrentMap;
                        break;

                    case SelectChoice.StartGame:
                        GameScreen.PushScreen(new DeathmatchMap(ArrayMapFile[CurrentMap].FullName, ListPlayer, 1));
                        GameScreen.RemoveScreen(this);
                        break;
                    }
                    Stage = 0;
                }
            }
            #endregion
            else
            {
                switch (SelectedChoice)
                {
                    #region Messenger
                case SelectChoice.Messenger:

                    Microsoft.Xna.Framework.Input.Keys[] Input = KeyboardHelper.KeyPressed();
                    for (int i = 0; i < Input.Count(); i++)
                    {
                        if (KeyboardHelper.KeyPressed(Input[i]))
                        {
                            if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Space)
                            {
                                Message     = Message.Insert(MessageCursorIndex, " ");
                                MessageDraw = MessageDraw.Insert(MessageCursorIndex, " ");
                                MessageCursorIndex++;
                                UpdateMessengerCursor();
                            }
                            else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Enter)
                            {
                                Messenger.Add(Message);
                                Message            = "";
                                MessageDraw        = "";
                                MessageCursorIndex = 0;
                            }
                            else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Back)
                            {
                                if (Message.Length > 0)
                                {
                                    MessageCursorIndex--;
                                    Message     = Message.Remove(MessageCursorIndex, 1);
                                    MessageDraw = MessageDraw.Remove(MessageCursorIndex, 1);
                                    UpdateMessengerCursor();
                                }
                            }
                            else if ((int)Input[i] >= 65 && (int)Input[i] <= 90)
                            {
                                Message     = Message.Insert(MessageCursorIndex, Input[i].ToString());
                                MessageDraw = MessageDraw.Insert(MessageCursorIndex, Input[i].ToString());
                                MessageCursorIndex++;
                                UpdateMessengerCursor();
                            }
                            else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Left)
                            {
                                MessageCursorIndex -= MessageCursorIndex > 0 ? 1 : 0;
                                UpdateMessengerCursor();
                            }
                            else if (Input[i] == Microsoft.Xna.Framework.Input.Keys.Right)
                            {
                                MessageCursorIndex += MessageCursorIndex < Message.Count() ? 1 : 0;
                                UpdateMessengerCursor();
                            }
                        }
                    }
                    if (KeyboardHelper.InputCancelPressed())
                    {
                        Stage = -1;
                    }
                    break;

                    #endregion
                    #region PlayerList
                case SelectChoice.PlayerList:
                    switch (Stage)
                    {
                    case 0:        //Player selection
                        if (KeyboardHelper.InputUpPressed())
                        {
                            PlayerIndex -= PlayerIndex > 0 ? 1 : 0;
                        }
                        else if (KeyboardHelper.InputDownPressed())
                        {
                            PlayerIndex += PlayerIndex < Math.Min(ListPlayer.Count, ListMap[CursorMap].NumberOfPlayers - 1) ? 1 : 0;
                        }
                        if (KeyboardHelper.InputLeftPressed() ||
                            KeyboardHelper.InputRightPressed() ||
                            KeyboardHelper.InputConfirmPressed())
                        {
                            SubMenu = 0;
                            Stage++;
                        }
                        else if (KeyboardHelper.InputCancelPressed())
                        {
                            Stage = -1;
                        }
                        break;

                    case 1:        //SubMenu selection
                        if (KeyboardHelper.InputUpPressed())
                        {
                            PlayerIndex -= PlayerIndex > 0 ? 1 : 0;
                        }
                        else if (KeyboardHelper.InputDownPressed())
                        {
                            PlayerIndex += PlayerIndex < Math.Min(ListPlayer.Count, ListMap[CursorMap].NumberOfPlayers - 1) ? 1 : 0;
                            if (PlayerIndex == ListMap[CursorMap].NumberOfPlayers - 1 && ListPlayer.Count < ListMap[CursorMap].NumberOfPlayers)
                            {
                                SubMenu = 0;
                            }
                        }
                        if (KeyboardHelper.InputLeftPressed() && (PlayerIndex != ListMap[CursorMap].NumberOfPlayers - 1 || ListPlayer.Count >= ListMap[CursorMap].NumberOfPlayers))
                        {
                            SubMenu -= SubMenu > 0 ? 1 : 0;
                        }
                        else if (KeyboardHelper.InputRightPressed() && (PlayerIndex != ListMap[CursorMap].NumberOfPlayers - 1 || ListPlayer.Count >= ListMap[CursorMap].NumberOfPlayers))
                        {
                            SubMenu += SubMenu < 2 ? 1 : 0;
                        }
                        else if (KeyboardHelper.InputCancelPressed())
                        {
                            Stage--;
                        }
                        else if (KeyboardHelper.InputConfirmPressed())
                        {
                            Stage++;
                            PlayerOptionIndex = 0;
                            if (SubMenu == 0)
                            {        //If the index is on the last player or on an empty space
                                if (PlayerIndex == ListPlayer.Count - 1 || PlayerIndex >= ListPlayer.Count)
                                {
                                    Types = new PlayerTypes[] { PlayerTypes.Closed, PlayerTypes.Human, PlayerTypes.CPUEasy }
                                }
                                ;
                                else
                                {
                                    Types = new PlayerTypes[] { PlayerTypes.Human, PlayerTypes.CPUEasy }
                                };
                            }
                        }
                        break;

                    case 2:        //PlayerOption selection
                        switch (SubMenu)
                        {
                        case 0:            //Player type
                            if (KeyboardHelper.InputUpPressed())
                            {
                                PlayerOptionIndex -= PlayerOptionIndex > 0 ? 1 : 0;
                            }
                            else if (KeyboardHelper.InputDownPressed())
                            {
                                PlayerOptionIndex += PlayerOptionIndex < Types.Count() - 1 ? 1 : 0;
                            }
                            else if (KeyboardHelper.InputConfirmPressed())
                            {
                                if (PlayerIndex < ListPlayer.Count)
                                {
                                    if (Types[PlayerOptionIndex] == PlayerTypes.Closed)
                                    {
                                        ListPlayer.RemoveAt(PlayerIndex);
                                    }
                                    else
                                    {
                                        ListPlayer[PlayerIndex].PType = Types[PlayerOptionIndex];
                                    }
                                }
                                else
                                {
                                    if (Types[PlayerOptionIndex] == PlayerTypes.Closed)
                                    {
                                        ListPlayer.RemoveAt(PlayerIndex);
                                    }
                                    else
                                    {
                                        List <Unit> ListUnit;
                                        ListUnit = new List <Unit>();

                                        /*ListUnit.Add(new UnitArmoredCore(UnitArmoredCore.ListUnitArmoredCore[0]));
                                         * ListUnit[0].Init();
                                         * ListUnit.Add(new UnitArmoredCore(UnitArmoredCore.ListUnitArmoredCore[0]));
                                         * ListUnit[1].Init();
                                         * ListUnit.Add(new UnitArmoredCore(UnitArmoredCore.ListUnitArmoredCore[0]));
                                         * ListUnit[2].Init();*/
                                        ListPlayer.Add(new Player("New player", Types[PlayerOptionIndex], ListUnit, 0));
                                    }
                                }
                                Stage--;
                            }
                            else if (KeyboardHelper.InputCancelPressed())
                            {
                                Stage--;
                            }
                            break;

                        case 1:            //Team
                            if (KeyboardHelper.InputUpPressed())
                            {
                                PlayerOptionIndex -= PlayerOptionIndex > 0 ? 1 : 0;
                            }
                            else if (KeyboardHelper.InputDownPressed())
                            {
                                PlayerOptionIndex += PlayerOptionIndex < ListMap[CursorMap].NumberOfTeam - 1 ? 1 : 0;
                            }
                            else if (KeyboardHelper.InputConfirmPressed())
                            {
                                ListPlayer[PlayerIndex].Team = PlayerOptionIndex;
                                Stage--;
                            }
                            else if (KeyboardHelper.InputCancelPressed())
                            {
                                Stage--;
                            }
                            break;
                        }
                        break;
                    }
                    break;

                    #endregion
                case SelectChoice.ChangeMap:
                    if (KeyboardHelper.InputUpPressed())
                    {
                        CursorMap--;
                        if (CursorMap < 0)
                        {
                            CursorMap = ListMap.Count - 1;
                        }
                    }
                    else if (KeyboardHelper.InputDownPressed())
                    {
                        CursorMap++;
                        if (CursorMap > ListMap.Count - 1)
                        {
                            CursorMap = 0;
                        }
                    }
                    else if (KeyboardHelper.InputConfirmPressed())
                    {
                        CurrentMap = CursorMap;
                        Stage--;
                    }
                    else if (KeyboardHelper.InputCancelPressed())
                    {
                        Stage--;
                    }
                    break;
                }
            }
            if (KeyboardHelper.KeyPressed(Microsoft.Xna.Framework.Input.Keys.Escape))
            {
                GameScreen.RemoveScreen(this);
            }
        }
Exemplo n.º 8
0
        //note: code overlap with FormDef.copyItemsetAnswer
        public IAnswerData getAnswerValue()
        {
            QuestionDef q = getQuestion();

            ItemsetBinding itemset = q.getDynamicChoices();

            if (itemset != null)
            {
                if (itemset.valueRef != null)
                {
                    List <SelectChoice> choices           = getSelectChoices();
                    List <String>       preselectedValues = new List <String>();

                    //determine which selections are already present in the answer
                    if (itemset.copyMode)
                    {
                        TreeReference        destRef  = itemset.getDestRef().contextualize(mTreeElement.getRef());
                        List <TreeReference> subNodes = form.Instance.expandReference(destRef);
                        for (int i = 0; i < subNodes.Count; i++)
                        {
                            TreeElement node  = form.Instance.resolveReference(subNodes[i]);
                            String      value = itemset.getRelativeValue().evalReadable(form.Instance, new EvaluationContext(form.exprEvalContext, node.getRef()));
                            preselectedValues.Add(value);
                        }
                    }
                    else
                    {
                        List <Selection> sels = new List <Selection>();
                        IAnswerData      data = mTreeElement.getValue();
                        if (data is SelectMultiData)
                        {
                            sels = (List <Selection>)data.Value;
                        }
                        else if (data is SelectOneData)
                        {
                            sels = new List <Selection>();
                            sels.Add((Selection)data.Value);
                        }
                        for (int i = 0; i < sels.Count; i++)
                        {
                            preselectedValues.Add(sels[i].xmlValue);
                        }
                    }

                    //populate 'selection' with the corresponding choices (matching 'value') from the dynamic choiceset
                    List <Selection> selection = new List <Selection>();
                    for (int i = 0; i < preselectedValues.Count; i++)
                    {
                        String       value  = preselectedValues[i];
                        SelectChoice choice = null;
                        for (int j = 0; j < choices.Count; j++)
                        {
                            SelectChoice ch = choices[j];
                            if (value.Equals(ch.Value))
                            {
                                choice = ch;
                                break;
                            }
                        }

                        selection.Add(choice.selection());
                    }

                    //convert to IAnswerData
                    if (selection.Count == 0)
                    {
                        return(null);
                    }
                    else if (q.ControlType == Constants.CONTROL_SELECT_MULTI)
                    {
                        return(new SelectMultiData(selection));
                    }
                    else if (q.ControlType == Constants.CONTROL_SELECT_ONE)
                    {
                        return(new SelectOneData(selection[0])); //do something if more than one selected?
                    }
                    else
                    {
                        throw new SystemException("can't happen");
                    }
                }
                else
                {
                    return(null); //cannot map up selections without <value>
                }
            }
            else
            { //static choices
                return(mTreeElement.getValue());
            }
        }
Exemplo n.º 9
0
 public String getSpecialFormSelectChoiceText(SelectChoice sel, String form)
 {
     return(getSpecialFormSelectItemText(sel.selection(), form));
 }
Exemplo n.º 10
0
 /**
  * @see getSelectItemText(Selection sel)
  */
 public String getSelectChoiceText(SelectChoice selection)
 {
     return(getSelectItemText(selection.selection()));
 }
Exemplo n.º 11
0
        static void Main()
        {
            try
            {
                ModelDB                 = new ContextModel(); // Intait DB Model.
                ModelDBLike             = new ContextModel(); // Intait DB Model.
                ModelDBComment          = new ContextModel(); // Intait DB Model.
                Console.ForegroundColor = ConsoleColor.Cyan;  // Set the color of Console Font

                ShowOption();                                 // See Options

                int selectOp = 0;
                try
                {
                    Console.Write("Your Select: ");
                    selectOp = int.Parse(Console.ReadLine());
                }
                catch (Exception ex) { Console.WriteLine(ex.Message); }
                SelectChoice Sc = new SelectChoice(SelectView);
                switch (selectOp)
                {
                case 1:
                    // This is Select for New Operation
                    StartNew(Sc.Invoke());
                    break;

                case 2:
                    Console.WriteLine("Insert the Post ID");
                    while (true)
                    {
                        Console.Write("Post ID: ");
                        string postId = Console.ReadLine();
                        if (!string.IsNullOrEmpty(postId))
                        {
                            if (ModelDB.Data.Where(s => s.PostID == postId).Count() == 0)
                            {
                                if (DeleteOption())
                                {
                                    break;
                                }                                // See Delete Options
                            }
                            else
                            {
                                //Delete The Operation and Data refer to it
                                DeleteOperation(postId);
                                break;
                            }
                        }
                        else
                        {
                            Console.WriteLine("Wrong ID or NULL\n Please Try again.");
                        }
                    }
                    break;

                case 3:
                    //Extract all the data from User Options.
                    Console.WriteLine("Hi, You can use this tools to Extract full data about the useres stored in your DB");
                    GetherDataOptions();
                    break;

                default:
                    Console.WriteLine("Wrong Selection Please try Again..\n");
                    for (int i = 5; i > 0; i--)
                    {
                        Thread.Sleep(500);
                        Console.Write(" " + i);
                        Console.Beep();
                    }
                    Application.Restart();
                    break;
                }
            }
            catch
            {
            }
        }