Exemple #1
0
    void OnMouseDown()
    {
        visible = false;
        sew.setVisible(false);
        sew.setRigidBody(false);
        hasBody = false;
        textbox1.GetComponent <changePos>().setPos(new Vector3(-7.1f, -1.5f, 0.0f));
        textbox2.GetComponent <changePos>().setPos(new Vector3(-7.1f, -2.5f, 0.0f));
        textbox3.GetComponent <changePos>().setPos(new Vector3(-3.9f, -1.5f, 0.0f));
        textbox4.GetComponent <changePos>().setPos(new Vector3(-3.9f, -2.5f, 0.0f));

        GameObject      displayQuestionObject = GameObject.Find("qq");
        DisplayQuestion displayQuestionScript = displayQuestionObject.GetComponent <DisplayQuestion> ();
        int             kkk = displayQuestionScript.boxNumber;

        //Question questemp = (Question)qs.GetComponent<DisplayQuestion> ().questions[kkk];

        DisplayQuestion.Question qls = (DisplayQuestion.Question)qs.GetComponent <DisplayQuestion> ().questions[kkk];
        //Debug.Log("questemp: "+qls.getQuestionText());
        string swg  = qls.getAnswerText(1).getAnswer();
        string swg2 = qls.getAnswerText(2).getAnswer();
        string swg3 = qls.getAnswerText(3).getAnswer();
        string swg4 = qls.getAnswerText(4).getAnswer();



        t1.GetComponent <TextMesh>().text  = ResolveTextSize(swg, 27);
        t2.GetComponent <TextMesh> ().text = ResolveTextSize(swg2, 27);
        t3.GetComponent <TextMesh> ().text = ResolveTextSize(swg3, 27);
        t4.GetComponent <TextMesh> ().text = ResolveTextSize(swg4, 27);
        //showButton = false;
    }
Exemple #2
0
        /// <summary>
        /// Register callbacks in order to handle VLC dialogs.
        /// LibVLC 3.0.0 and later.
        /// </summary>
        /// <param name="error">Called when an error message needs to be displayed.</param>
        /// <param name="login">Called when a login dialog needs to be displayed.
        /// You can interact with this dialog by calling Dialog.PostLogin() to post an answer or Dialog.Dismiss() to cancel this dialog.</param>
        /// <param name="question">Called when a question dialog needs to be displayed.
        /// You can interact with this dialog by calling Dialog.PostLogin() to post an answer or Dialog.Dismiss() to cancel this dialog.</param>
        /// <param name="displayProgress">Called when a progress dialog needs to be displayed.</param>
        /// <param name="updateProgress">Called when a progress dialog needs to be updated.</param>
        public void SetDialogHandlers(DisplayError error, DisplayLogin login, DisplayQuestion question,
                                      DisplayProgress displayProgress, UpdateProgress updateProgress)
        {
            _error           = error ?? throw new ArgumentNullException(nameof(error));
            _login           = login ?? throw new ArgumentNullException(nameof(login));
            _question        = question ?? throw new ArgumentNullException(nameof(question));
            _displayProgress = displayProgress ?? throw new ArgumentNullException(nameof(displayProgress));
            _updateProgress  = updateProgress ?? throw new ArgumentNullException(nameof(updateProgress));

            Native.LibVLCDialogSetCallbacks(NativeReference, DialogCb, GCHandle.ToIntPtr(_gcHandle));
        }
Exemple #3
0
        public DisplayQuestion getQuestion(List <int> Ids)
        {
            DisplayQuestion displayQuestion = new DisplayQuestion();

            var exceptedQuestion = DbContext.Questions.Where(q => !Ids.Contains(q.Id)).FirstOrDefault();

            displayQuestion.Question = exceptedQuestion;
            // DbContext.Questions.Where(q=>q.Id==3).FirstOrDefault();

            if (displayQuestion.Question != null)
            {
                int QuestionID = displayQuestion.Question.Id;
                displayQuestion.Answers = DbContext.Answers.Where(A => A.Question.Id == QuestionID).ToList();
            }
            return(displayQuestion);
        }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        /*DisplayQuestion d = (DisplayQuestion) gBox.GetComponent("DisplayQuestion");
         * int kkk = d.getBox ();
         * Debug.Log(kkk);
         * TextMesh t = (TextMesh)GetComponent ("TextMesh");
         * t.text = kkk.ToString();*/

        GameObject      displayQuestionObject = GameObject.Find("qq");
        DisplayQuestion displayQuestionScript = displayQuestionObject.GetComponent <DisplayQuestion> ();
        int             kkk = displayQuestionScript.boxNumber;

        Debug.Log("Box Number: " + kkk);
        TextMesh t = (TextMesh)GetComponent("TextMesh");

        t.text = kkk.ToString();
    }
Exemple #5
0
        public PlayPresenter(IPlayView view, IPlayRepository repository, Game game)
        {
            this.view       = view;
            view.Presenter  = this;
            this.repository = repository;
            this.game       = game;

            switch (game.CategoryGuess)
            {
            case "flag":
                this.displayQuestion = new DisplayQuestion(displayQuestionAsFlag);
                break;

            case "capital":
                this.displayQuestion = new DisplayQuestion(displayQuestionAsCapital);
                break;

            default:
                this.displayQuestion = new DisplayQuestion(displayQuestionAsCountry);
                break;
            }

            switch (game.CategoryHint)
            {
            case "flag":
                this.displayAnswers = new DisplayAnswers(displayAnswersAsFlag);
                break;

            case "capital":
                this.displayAnswers = new DisplayAnswers(displayAnswersAsCapital);
                break;

            default:
                this.displayAnswers = new DisplayAnswers(displayAnswersAsCountry);
                break;
            }
        }
Exemple #6
0
        public void SetDialogHandlers(DisplayError error, DisplayLogin login, DisplayQuestion question,
                                      DisplayProgress displayProgress, UpdateProgress updateProgress)
        {
            if (error == null)
            {
                throw new ArgumentNullException(nameof(error));
            }
            if (login == null)
            {
                throw new ArgumentNullException(nameof(login));
            }
            if (question == null)
            {
                throw new ArgumentNullException(nameof(question));
            }
            if (displayProgress == null)
            {
                throw new ArgumentNullException(nameof(displayProgress));
            }
            if (updateProgress == null)
            {
                throw new ArgumentNullException(nameof(updateProgress));
            }

            var dialogCbs = new DialogCallbacks
            {
                DisplayError = (data, title, text) =>
                {
                    // no dialogId ?!
                    error(title, text);
                },
                DisplayLogin = (data, id, title, text, username, store) =>
                {
                    var cts = new CancellationTokenSource();
                    var dlg = new Dialog(new DialogId {
                        NativeReference = id
                    });
                    _cts.Add(id, cts);
                    login(dlg, title, text, username, store, cts.Token);
                },
                DisplayQuestion = (data, id, title, text, type, cancelText, firstActionText, secondActionText) =>
                {
                    var cts = new CancellationTokenSource();
                    var dlg = new Dialog(new DialogId {
                        NativeReference = id
                    });
                    _cts.Add(id, cts);
                    question(dlg, title, text, type, cancelText, firstActionText, secondActionText, cts.Token);
                },
                DisplayProgress = (data, id, title, text, indeterminate, position, cancelText) =>
                {
                    var cts = new CancellationTokenSource();
                    var dlg = new Dialog(new DialogId {
                        NativeReference = id
                    });
                    _cts.Add(id, cts);
                    displayProgress(dlg, title, text, indeterminate, position, cancelText, cts.Token);
                },
                Cancel = (data, id) =>
                {
                    if (_cts.TryGetValue(id, out var token))
                    {
                        token.Cancel();
                        _cts.Remove(id);
                    }
                },
                UpdateProgress = (data, id, position, text) =>
                {
                    var dlg = new Dialog(new DialogId {
                        NativeReference = id
                    });
                    updateProgress(dlg, position, text);
                }
            };

            _dialogCbsPtr = Marshal.AllocHGlobal(Marshal.SizeOf <DialogCallbacks>());
            Marshal.StructureToPtr(dialogCbs, _dialogCbsPtr, true);
            Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbsPtr, IntPtr.Zero);
        }
        // GET: Reviews/Review/5?emp=NNNN
        public async Task <IActionResult> Review(int?id, string emp, char?printable)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToRoute(new
                {
                    controller = "Account",
                    action = "Login"
                }));
            }

            int     reviewID    = (id == null) ? -1 : (int)id;
            Boolean isPrintable = (printable == null) ? false : true;

            // emp is the employee whose review it is - it is a required parameter
            if (emp == null)
            {
                return(NotFound());
            }
            string targetID = emp.Trim();

            // Make sure user has permission to view
            ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User);

            // Redirect to their own index page if they don't have permission to view
            if (targetID != user.EmployeeID)
            {
                if (!viewAllowed(user.EmployeeID, targetID))
                {
                    return(RedirectToRoute(new
                    {
                        controller = "Reviews",
                        action = "Index"
                    }));
                }
            }

            // Get the review ID (and create if needed)
            string getEmployee = "EXECUTE dbo.avp_Get_Employee @UserEmpId";
            var    empId       = new SqlParameter("@UserEmpId", targetID);
            var    employee    = await _context.Employees.FromSql(getEmployee, empId)
                                 .SingleOrDefaultAsync <Employees>();

            string role = GetRole(Convert.ToInt32(user.EmployeeID), employee);

            if (reviewID < 0) // Just get the current one.
            {
                if (employee.CurrentReview == null || employee.CurrentReview == 0)
                {
                    // We need to create a new review for this employee
                    DateTime startDate = DateTime.Now;
                    DateTime endDate   = startDate.AddDays(90);

                    var createReviewCmd = _context.Database.GetDbConnection().CreateCommand();
                    // Call the avp_New_Review stored procedure and get the resulting ID
                    createReviewCmd.CommandText = "DECLARE	@return_value int "+
                                                  "EXEC	@return_value = [dbo].[avp_New_Review] " +
                                                  String.Format("@EmpID = {0}, @SupID = {1}, @RT_ID = 2, @PeriodStart = \"{2}\", @PeriodEnd = \"{3}\" ",
                                                                employee.EmpId, employee.SupId,
                                                                startDate.ToString("yyyy-MM-dd"),
                                                                endDate.ToString("yyyy-MM-dd")) +
                                                  "SELECT  'ReturnValue' = @return_value";

                    _context.Database.OpenConnection();
                    using (var result = createReviewCmd.ExecuteReader())
                    {
                        if (result.HasRows)
                        {
                            if (result.Read())
                            {
                                employee.CurrentReview = result.GetInt32(0);
                            }
                        }
                    }
                }
                reviewID = (int)employee.CurrentReview;
            }

            // Now read the review
            DisplayReview rev = null;

            var getReviewCmd = _context.Database.GetDbConnection().CreateCommand();

            getReviewCmd.CommandText = "EXEC [dbo].[avp_Get_A_Review] " +
                                       String.Format("@ReviewID = {0}", reviewID);
            _context.Database.OpenConnection();
            using (var result = getReviewCmd.ExecuteReader())
            {
                if (result.HasRows)
                {
                    while (result.Read())
                    {
                        if (rev == null)
                        {
                            string empresp = result.IsDBNull(17) ? "" : result.GetString(17);
                            rev = new DisplayReview(
                                result.GetInt32(1),    // R_ID
                                result.GetString(2),   // Status
                                result.GetInt32(4),    // ReviewerID
                                result.GetInt32(5),    // EmpID
                                result.GetString(7),   // Position
                                result.GetDateTime(8), // PeriodStart
                                result.GetDateTime(9), // PeriodEnd
                                result.GetString(20),  // Reviewer
                                result.GetString(23),  // Employee
                                empresp,
                                //  result.GetString(100), //Response
                                result.GetDateTime(9) //ResonseDate

                                );
                        }
                        string          qtext = result.IsDBNull(13) ? null : result.GetString(13);
                        string          atext = result.IsDBNull(15) ? null : result.GetString(15);
                        DisplayQuestion q     = new DisplayQuestion(
                            result.GetInt32(14),  // Q_ID
                            result.GetString(12), // QT_Type
                            qtext,                // QT_Question
                            atext,                // Answer
                            result.GetBoolean(16) // Required flag
                            );
                        rev.questions.Add(q);
                    }
                }
            }

            ViewData["Role"]         = role;
            ViewData["ReviewStatus"] = rev.status;
            ViewData["printable"]    = isPrintable;
            return(View(rev));
        }