示例#1
0
        public static PlugResponse FireAction(string ActionName, string sentence)
        {
            PlugResponse response = new PlugResponse();
            PlugCall     call     = new PlugCall();

            call.ACTION = ActionName;
            call.Text   = sentence;

            SENTENCES tmp = CONTEXT.SENTENCESLIST.Where(t => t.CMD.CMD.Equals(ActionName)).Where(t => t.SENTENCE.Equals(sentence)).Single();

            // Todo: recherche une correspondance dans la BDD
            if (tmp == null)
            {
                return(new PlugResponse());
            }

            else
            {
                // Chargement de la DLL concernée
                SENTENCES cmd = GlobalManager.CONTEXT.SENTENCESLIST.Where(t => t.CMD.CMD.Equals(ActionName) && t.SENTENCE.Equals(sentence)).Single();
                if (cmd.CMD.MODULE.NAME.Equals("SYSTEM"))
                {
                    response     = SYSMODULE.DoAction(call);
                    LastResponse = response;
                    return(response);
                }
                else
                {
                    /* TEST */
                    // Chargement de la DLL
                    string          DLLPATH    = cmd.CMD.MODULE.DLL;
                    List <Assembly> assemblies = new List <Assembly>();
                    Assembly        DLL        = Assembly.LoadFrom(@"C:\Users\adasilva\Documents\Visual Studio 2015\Projects\MATHIAS\Mathias\bin\Debug\plugins\EmailPlug.dll");

                    // Récupération de l'objet à utiliser
                    var typeFromPlug = DLL.GetType(cmd.CMD.FULLTYPEOBJECT);
                    var plug         = Activator.CreateInstance(typeFromPlug, new object[] { "imap.gmail.com", "login", "password", 993 });

                    // Récupération de la méthode
                    var method = typeFromPlug.GetMethod("DoAction");

                    //Execution de la méthode et retour du cast
                    return((PlugResponse)method.Invoke(plug, new object[] { call }));
                }

                response = new PlugResponse();
                // LOAD DLL
            }

            // Création de l'objet PlugCall
            // Lancement de la méthode concernée
            // Si non
            // Indiquer aucune commande correspondante.

            return(null);
        }
示例#2
0
    void Start()
    {
        HTTPRequest www = new HTTPRequest(new Uri(GameManager.Instance.webURLPrefix + Client.SENTENCES), (request, response) => {
            HTTPResponse res = (HTTPResponse)response;
            if (res.IsSuccess)
            {
                List <object> dic = Json.Decode(res.DataAsText) as List <object>;
                SList             = new List <SENTENCES>();
                foreach (Dictionary <string, object> a in dic)
                {
                    SENTENCES s = new SENTENCES();
                    s._id       = a["_id"].ToString();
                    s.__v       = a["__v"].ToString();
                    s.puzzle    = a["puzzle"].ToString();
                    SList.Add(s);
                }

                HTTPRequest conf = new HTTPRequest(new Uri(GameManager.Instance.webURLPrefix + Client.CONFIGS), (requestC, responseC) => {
                    HTTPResponse resConf = (HTTPResponse)responseC;
                    if (resConf.IsSuccess)
                    {
                        List <object> conRes = Json.Decode(resConf.DataAsText) as List <object>;
                        CList = new List <CONFIGS>();
                        foreach (Dictionary <string, object> b in conRes)
                        {
                            CONFIGS c                 = new CONFIGS();
                            c._id                     = b["_id"].ToString();
                            c.intro_text              = b["intro_text"].ToString();
                            c.group_size_min          = b["group_size_min"].ToString();
                            c.group_size_max          = b["group_size_max"].ToString();
                            c.game_session_time_limit = b["game_session_time_limit"].ToString();
                            c.game_rounds_min         = b["game_rounds_min"].ToString();
                            c.game_rounds_max         = b["game_rounds_max"].ToString();
                            c.game_letters            = b["game_letters"].ToString();
                            c.loop_time               = new List <string>();
                            foreach (object t in b["loop_time"] as List <object> )
                            {
                                c.loop_time.Add(t.ToString());
                            }
                            c.leters_round_min     = b["leters_round_min"].ToString();
                            c.leters_round_max     = b["leters_round_max"].ToString();
                            c.round_countdown_time = b["round_countdown_time"].ToString();
                            c.__v     = b["__v"].ToString();
                            c.created = b["created"].ToString();
                            c.name    = b["name"].ToString();

                            CList.Add(c);
                        }
                    }
                }).Send();
            }
        }).Send();
    }
示例#3
0
    void OnEnable()
    {
        s               = GameManager.Instance.client.GetRandomS();
        sentence.text   = s.puzzle;
        totalRound      = PlayerPrefs.GetInt("wRound", 1);
        ring.fillAmount = 0;
        GameManager.Instance.currentRound++;

        GameManager.Instance.Scroll.transform.parent.GetChild(0).gameObject.SetActive(false);
        GameManager.Instance.unlimited = false;
        switch (PlayerPrefs.GetInt("wMode", 0))
        {
        case 0:
            chechTime = 30;
            break;

        case 1:
            chechTime = 60;
            break;

        case 2:
            chechTime = 90;
            break;

        case 3:
            chechTime = 300;
            GameManager.Instance.unlimited = true;
            break;
        }

        round.text = "Round " + GameManager.Instance.currentRound.ToString() + "/" + totalRound.ToString();
        PopulateSLetters();
        //Ghilman
        Debug.Log(DateTime.Now);
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mDate = DateTime.Now.ToString();
        Debug.Log(GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mDate);
        //Ghilman
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mDuration = chechTime.ToString();
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mId       = GameManager.Instance.mItemDataList.Count - 1;
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mName     = PlayerPrefs.GetString("mName", "Solo");
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mPic      = "";
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].mChecked  = false;
        RoundData rData = new RoundData();

        rData.mSenence        = s.puzzle;
        rData.mCompleted      = false;
        rData.reCheck         = true;
        rData.mTotalRoundTime = chechTime.ToString();
        rData.time            = DateTime.Now.TimeOfDay.ToString();
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].rData.Add(rData);
    }
示例#4
0
    public void NextRound()
    {
        //Ghilman
        // SetMainInpufield();
        //Ghilman
        List <RoundData> r = GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].rData;

        if (GameManager.Instance.currentRound >= totalRound && GameManager.Instance.menuManager.NavigationStackPeek() != UIManager.State.Win)
        {
            GameManager.Instance.cardIndex = GameManager.Instance.mItemDataList.Count - 1;
            r[r.Count - 1].id      = GameManager.Instance.currentRound - 1;
            r[r.Count - 1].reCheck = true;
            Debug.Log("NextRound");
            GameManager.Instance.menuManager.PushMenu(UIManager.State.Win);
            startime = false;
            return;
        }

        if (GameManager.Instance.menuManager.NavigationStackPeek() == UIManager.State.Win)
        {
            return;
        }

        r[r.Count - 1].id      = GameManager.Instance.currentRound - 1;
        r[r.Count - 1].reCheck = true;
        sec = 0f;

        GameManager.Instance.currentRound++;

        GameManager.Instance.Scroll.transform.parent.GetChild(0).gameObject.SetActive(false);
        GameManager.Instance.unlimited = false;
        switch (PlayerPrefs.GetInt("wMode", 0))
        {
        case 0:
            chechTime = 30;
            break;

        case 1:
            chechTime = 60;
            break;

        case 2:
            chechTime = 90;
            break;

        case 3:
            chechTime = 300;
            GameManager.Instance.unlimited = true;
            break;
        }
        s             = GameManager.Instance.client.GetRandomS();
        sentence.text = s.puzzle;
        totalRound    = PlayerPrefs.GetInt("wRound", 1);
        round.text    = "Round " + GameManager.Instance.currentRound.ToString() + "/" + totalRound.ToString();
        PopulateSLetters();
        ClearTextInSlot();
        RoundData rData = new RoundData();

        rData.mSenence        = s.puzzle;
        rData.mCompleted      = false;
        rData.mTotalRoundTime = chechTime.ToString();
        rData.time            = DateTime.Now.TimeOfDay.ToString();
        rData.reCheck         = true;
        GameManager.Instance.mItemDataList[GameManager.Instance.mItemDataList.Count - 1].rData.Add(rData);
    }