Inheritance: MonoBehaviour
Exemplo n.º 1
0
	public static ChoiceManager GetInstance()
	{
		if(_instance == null)
		{
			_instance = GameObject.Find("ChoiceManager").GetComponent<ChoiceManager>();
		}

		return _instance;
	}
Exemplo n.º 2
0
 public void StartDialogue()
 {
     UIManager.currentScript = this;
     if (dialogue)
     {
         DialogueManager.SetDialogue(dialogue, speaker);
     }
     else if (HasChoices)
     {
         ChoiceManager.ShowChoices(choices);
     }
 }
Exemplo n.º 3
0
 private void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 4
0
        private void frmStdExam_Load(object sender, EventArgs e)
        {
            myCombos = new ComboBox[] { comboBox1, comboBox2, comboBox3, comboBox4, comboBox5, comboBox6, comboBox7, comboBox8, comboBox9, comboBox10 };

            questions           = QuestionManager.getQuestionList(Convert.ToInt32(frmLogin.StID), Convert.ToInt32(frmStudentCrs.CrsID));
            qBS                 = new BindingSource(questions, "");
            quesGrid.DataSource = qBS;
            quesGrid.ReadOnly   = true;
            quesGrid.Columns["Q_Id"].Visible      = false;
            quesGrid.Columns["Q_Ans"].Visible     = false;
            quesGrid.Columns["State"].Visible     = false;
            quesGrid.Columns["Q_Type"].Visible    = false;
            quesGrid.Columns["Q_Grade"].Visible   = false;
            quesGrid.Columns["Q_Desc"].HeaderText = "Questions:";
            quesGrid.AutoSizeColumnsMode          = DataGridViewAutoSizeColumnsMode.AllCells;
            quesGrid.ColumnHeadersVisible         = false;
            quesGrid.RowHeadersVisible            = false;

            foreach (DataGridViewRow x in quesGrid.Rows)
            {
                x.MinimumHeight = 40;
            }

            quesGrid.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.None;

            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();

            columnHeaderStyle.BackColor        = Color.LightSkyBlue;
            columnHeaderStyle.Font             = new Font("Verdana", 9, FontStyle.Bold);
            quesGrid.EnableHeadersVisualStyles = false;
            quesGrid.SelectionMode             = DataGridViewSelectionMode.FullRowSelect;


            for (int i = 0; i < myCombos.Length; i++)
            {
                int id = Convert.ToInt32(quesGrid.Rows[i].Cells[0].Value.ToString());
                choices = ChoiceManager.questionChoices(id);
                chBS    = new BindingSource(choices, "");
                myCombos[i].DataSource = chBS;

                //string combo = c.Name;

                myCombos[i].DisplayMember = "Choice1";
                myCombos[i].ValueMember   = "Q_Id";
            }


            formGrade = new frmCrsGrade();
            exam      = ExamManager.getExamDuration(Convert.ToInt32(frmStudentCrs.CrsID));
            examBS    = new BindingSource(exam, "");
            durationLbl.DataBindings.Add("Text", examBS, "Ex_duration", true);
        }
Exemplo n.º 5
0
        private void btnCalc_Click(object sender, EventArgs e)
        {
            int k = int.Parse(txtBxK.Text); //кол-во планшетов
            int m = int.Parse(txtBxM.Text); //объем памяти
            int r = int.Parse(txtBxR.Text); //рейтинг

            decimal sum = 0;

            var chipTablets = ChoiceManager.GetChipsTablet(_tablets, k, m, r, out sum);

            dataGridView2.DataSource = chipTablets;
            txtBxTotal.Text          = sum.ToString("C2");
        }
    protected override void Awake()
    {
        base.Awake();

        gameManager   = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
        choiceManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <ChoiceManager>();

        if (choiceManager.CheckChoice(7) != 1)
        {
            player.GetComponent <PlayerController>().hasPartner = false;
            partner.gameObject.SetActive(false);
        }
    }
Exemplo n.º 7
0
        private async void Page_Loading(FrameworkElement sender, object args)
        {
            var obj = App.Current as App;

            YearTermManager.http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", obj.AccessToken);
            OptionManager.http.DefaultRequestHeaders.Authorization   = new AuthenticationHeaderValue("Bearer", obj.AccessToken);
            ChoiceManager.http.DefaultRequestHeaders.Authorization   = new AuthenticationHeaderValue("Bearer", obj.AccessToken);

            await ChoiceManager.GetChoices(Choices);

            await OptionManager.GetOptions(Options);

            await YearTermManager.GetYearTerms(YearTerms);

            LoadComboBoxes();
        }
    private void OnGeometryChange(GeometryChangedEvent evt)
    {
        var choices = new List <VisualElement>();

        this.Query <VisualElement>().Class("choice").ToList(choices);
        choiceManager = new ChoiceManager <VisualElement>(choices);

        for (int i = 0; i < choiceManager.choices.Count; i++)
        {
            int           index   = i;
            VisualElement element = choiceManager.choices[index];
            element.RegisterCallback((ClickEvent _evt) => { Choose(index); });
        }

        UnregisterCallback <GeometryChangedEvent>(OnGeometryChange);
    }
Exemplo n.º 9
0
        static void Choice()
        {
            decimal sum = 0;

            Console.Write("K = ");
            int k = int.Parse(Console.ReadLine());

            Console.Write("M = ");
            int m = int.Parse(Console.ReadLine());

            Console.Write("R = ");
            int r = int.Parse(Console.ReadLine());

            var chipTablets = ChoiceManager.GetChipsTablet(_tablets, k, m, r, out sum);

            Show(chipTablets);
            Console.WriteLine("Сумма = " + sum);
        }
Exemplo n.º 10
0
        private async void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new Windows.UI.Popups.MessageDialog("");

            if (StudentNumberBox.Text != "" || FirstNameBox.Text != "" || LastNameBox.Text != "")
            {
                if (Choice1ComboBox.SelectedValue != Choice2ComboBox.SelectedValue ||
                    Choice1ComboBox.SelectedValue != Choice3ComboBox.SelectedValue ||
                    Choice1ComboBox.SelectedValue != Choice4ComboBox.SelectedValue ||
                    Choice2ComboBox.SelectedValue != Choice3ComboBox.SelectedValue ||
                    Choice2ComboBox.SelectedValue != Choice4ComboBox.SelectedValue ||
                    Choice3ComboBox.SelectedValue != Choice4ComboBox.SelectedValue)
                {
                    string studentId    = StudentNumberBox.Text;
                    string fName        = FirstNameBox.Text;
                    string lName        = LastNameBox.Text;
                    int    firstChoice  = (int)Choice1ComboBox.SelectedValue;
                    int    secondChoice = (int)Choice2ComboBox.SelectedValue;
                    int    thirdChoice  = (int)Choice3ComboBox.SelectedValue;
                    int    fourthChoice = (int)Choice4ComboBox.SelectedValue;

                    int YearTermId = defaultYearTerm.YearTermId;
                    var obj        = new { StudentId = studentId, StudentFirstName = fName, StudentLastName = lName, FirstChoiceOptionId = firstChoice, SecondChoiceOptionId = secondChoice, ThirdChoiceOptionId = thirdChoice, FourthChoiceOptionId = fourthChoice, YearTermId = YearTermId, SelectionDate = DateTime.Now.ToString() };
                    var obj2       = App.Current as App;
                    ChoiceManager.http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", obj2.AccessToken);
                    await ChoiceManager.AddChoice(new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/json"));
                }
                else
                {
                    dialog = new Windows.UI.Popups.MessageDialog("Your choices must be unique.");
                    await dialog.ShowAsync();
                }
            }
            else
            {
                dialog = new Windows.UI.Popups.MessageDialog("Do not leave any of the fields empty.");
                await dialog.ShowAsync();
            }
        }
Exemplo n.º 11
0
    void Awake()
    {
        System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures)[0];

        appPath = Application.streamingAssetsPath;

        dialogueLine = new List <int>(1)
        {
            0
        };

        parser        = new TextParser(this);
        choiceManager = new ChoiceManager();
        charManager   = new CharacterManager(startingCast);

        themeConstructor = new ThemeConstructor(this);

        uiConstructor = new UIConstructor();
        uiManager     = new UIManager(this, uiConstructor.ConstructText(Color.black), uiConstructor.ConstructGroup(1, false, Color.gray), uiConstructor.ConstructCanvas(), uiConstructor.ConstructButton(Color.black, Color.black), uiConstructor.ConstructGroup(0, false, Color.gray), uiConstructor.ConstructLayoutGroup());

        varManager      = new VariableManager();
        functionManager = new FunctionManager(this);

        //Base starting values
        if (startWithExposition)
        {
            varManager.SetVar(new string[] { "charVisible=0" });
        }
        else
        {
            varManager.SetVar(new string[] { "charVisible=1" });
        }
        varManager.SetVar(new string[] { "typeRate=" + startingTextSpeed });
        varManager.SetVar(new string[] { "buildV=" + version });
        varManager.SetVar(new string[] { "pitch=1" });

        thes      = new Thesaurus("Default");
        uiManager = themeConstructor.ConstructTheme("Default");
    }
Exemplo n.º 12
0
    // Start is called before the first frame update
    void Awake()
    {
        gameManager = GetComponent <GameManager>();

        choice1Text = choice1.GetComponentInChildren <TextMeshProUGUI>();
        choice2Text = choice2.GetComponentInChildren <TextMeshProUGUI>();

        choiceManager   = GetComponent <ChoiceManager>();
        cutsceneManager = GetComponent <CutsceneManager>();

        cutsceneBox = GameObject.FindGameObjectWithTag("Dialogue Box");

        cutsceneText = cutsceneBox.GetComponentInChildren <TextMeshProUGUI>();
        nameBox      = GameObject.FindGameObjectWithTag("Name Box");
        nameText     = nameBox.GetComponentInChildren <TextMeshProUGUI>();


        player = GameObject.FindGameObjectWithTag("Player");

        playerConfig = gameManager.playerConfig;

        interactKey = playerConfig.interactKey;
    }
Exemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     cm = GameObject.Find("ChoiceManager").GetComponent <ChoiceManager> ();
 }
Exemplo n.º 14
0
 // Start is called before the first frame update
 void Start()
 {
     theOrder  = FindObjectOfType <OrderManager2>();
     theChoice = FindObjectOfType <ChoiceManager>();
 }
Exemplo n.º 15
0
 // Start is called before the first frame update
 void Start()
 {
     TheDM     = FindObjectOfType <Dialog_Manager>();
     theChoice = FindObjectOfType <ChoiceManager>();
     theDB     = FindObjectOfType <DataBaseManager>();
 }
Exemplo n.º 16
0
 private async void Page_Loading(FrameworkElement sender, object args)
 {
     await ChoiceManager.GetChoices(Choices);
 }
Exemplo n.º 17
0
 void Start()
 {
     choiceManager = GetComponent <ChoiceManager> ();
     pauseManager  = GetComponent <PauseManager> ();
 }
Exemplo n.º 18
0
 private void Start()
 {
     choicemanager = GameObject.Find("ChoiceManager").GetComponent <ChoiceManager>();
     animator      = GameObject.Find("Ment").GetComponent <Animator>();
     mentManager   = GameObject.Find("Ment").GetComponent <MentManager>();
 }
Exemplo n.º 19
0
    public void Initialize(string thisname)
    {
        enemyname     = thisname;
        dataManager   = new DataManager();
        choiceManager = choiceManagerObject.GetComponent <ChoiceManager>();

        choice = dataManager.giveChoice(enemyname);
        if (enemyname == "ArcherMob" || enemyname == "KnightMob" || enemyname == "WarriorMob" || enemyname == "MageMob")
        {
            choiceManager.SetChoice(choice, dataManager.giveCompanion(enemyname));
        }
        else
        {
            choiceManager.SetChoice(choice);
        }

        switch (thisname)
        {
        case "Goblin":
            gameObject.GetComponent <SpriteRenderer>().sprite = Goblin;
            break;

        case "Ork":
            gameObject.GetComponent <SpriteRenderer>().sprite = Ork;
            break;

        case "Gnoll":
            gameObject.GetComponent <SpriteRenderer>().sprite = Gnoll;
            break;

        case "Chicken":
            gameObject.GetComponent <SpriteRenderer>().sprite = Chicken;
            break;

        case "Wolf":
            gameObject.GetComponent <SpriteRenderer>().sprite = Wolf;
            break;

        case "Boar":
            gameObject.GetComponent <SpriteRenderer>().sprite = Boar;
            break;

        case "GodStatue":
            gameObject.GetComponent <SpriteRenderer>().sprite = GodStatue;
            break;

        case "Lake":
            gameObject.GetComponent <SpriteRenderer>().sprite = Lake;
            break;

        case "Mimic":
            gameObject.GetComponent <SpriteRenderer>().sprite = Mimic;
            break;

        case "TreasureChest":
            gameObject.GetComponent <SpriteRenderer>().sprite = Mimic;
            break;

        case "ArcherMob":
            gameObject.GetComponent <SpriteRenderer>().sprite = ArcherMob;
            break;

        case "KnightMob":
            gameObject.GetComponent <SpriteRenderer>().sprite = KnightMob;
            break;

        case "MageMob":
            gameObject.GetComponent <SpriteRenderer>().sprite = MageMob;
            break;

        case "WarriorMob":
            gameObject.GetComponent <SpriteRenderer>().sprite = WarriorMob;
            break;

        default:
            gameObject.GetComponent <SpriteRenderer>().sprite = Goblin;
            break;
        }
    }
Exemplo n.º 20
0
 // Start is called before the first frame update
 void Start()
 {
     npc = transform.root.gameObject;
     gameObject.SetActive(false);
     theChoice = FindObjectOfType <ChoiceManager>();
 }
Exemplo n.º 21
0
    /**
     * @param currentEvent is the event received from the smart object
     * check if currentEvent is equal to the type of event that I expect
     */
    public void checkEvent(EventObject currentEvent)
    {
        lastRoueletteState = rouletteState;
        roulette           = GameObject.Find("Box8").GetComponent <Roulette>();
        rouletteState      = roulette.getState();

        if (rouletteState != 0)
        {
            desiredEventType = defineCategoryForState(rouletteState);
        }
        else
        {
            desiredEventType = 0;
        }
        //int desiredEventType = 2;



        if (desiredEventType == 0)
        {
            // I don't have a desired event to check
            return;
        }

        if (currentEvent.getDuration() != null)
        {
            //if duration=0 it is the first event of the sensor
            return;
        }
        else
        {
            switch (desiredEventType)
            {
            case 1:
                //hold the dolphin for 5 second
                conditionVerified = checkHoldDolphin(currentEvent);
                break;

            case 2:
                //cuddle the dolphin 3 times

                conditionVerified = checkCuddleDolphin(currentEvent);
                break;

            case 3:
                // RFID food
                conditionVerified = checkRfidFood(currentEvent);
                break;

            case 4:
                //RFID hygiene
                conditionVerified = checkRfidHygiene(currentEvent);
                break;

            case 5:
                //RFID entertainment
                conditionVerified = checkRfidEnterteinment(currentEvent);
                break;

            case 6:
                //RFID sleep
                conditionVerified = checkRfidSleep(currentEvent);
                break;
            }

            if (conditionVerified)
            {
                Debug.Log("Condition verified");


                if (desiredEventType != 2 & desiredEventType != 1)
                {
                    roulette.showRight(0);//0
                    roulette.playRight();
                    //CALL TO MIRKO'S CODE
                    ChoiceManager choiceManager = GameObject.Find("ChoiceManager").GetComponent <ChoiceManager>();
                    choiceManager.GenerateObjectsInWorld(rouletteState);
                }
                else
                {
                    if (desiredEventType == 2)
                    {
                        roulette.showRight(2); //2
                        roulette.playRight();
                    }
                    if (desiredEventType == 1)
                    {
                        roulette.showRight(1);//1
                        roulette.playRight();
                    }

                    //roulette.stopRoulette();
                    StartCoroutine(Wait());
                }
            }
            else
            {
                //if (currentEvent.getID() == TOUCH_SENSOR_CUDDLE && desiredEventType == 2)
                if (cuddleCount != 0)
                {
                    roulette.playRight();
                }
                else
                {
                    Debug.Log("Condition not verified");
                    if (desiredEventType == 1 && (currentEvent.getID() == TOUCH_SENSOR_CUDDLE | currentEvent.getID() == TOUCH_SENSOR_HOLD))
                    {
                        roulette.playRight();
                    }
                    else
                    {
                        roulette.playWrong();
                        roulette.showWrong();
                    }
                    if (desiredEventType == 2)
                    {
                        ProgressIndicator.Instance.SetProgress(0f);
                    }
                }
            }
        }
    }
Exemplo n.º 22
0
    public void TriggerChoice()
    {
        ChoiceManager _choiceManager = ChoiceManager.instance;

        _choiceManager.StartChoice(choice);
    }
Exemplo n.º 23
0
 void Start()
 {
     myRigidBody          = GetComponent <Rigidbody2D>();
     myRigidBody.velocity = new Vector2(directionSpeed, 0);
     cm = FindObjectOfType <ChoiceManager>();
 }
Exemplo n.º 24
0
 // Use this for initialization
 void Awake()
 {
     Instance    = this;
     choiceArray = ReadJsonFile(fileName);
 }
Exemplo n.º 25
0
 void Awake()
 {
     instance = this;
 }