Exemplo n.º 1
0
 private void HandleTreeActivationGroup(GameObject go, ActivationController TreeLevelAC)
 {
     foreach (ShaderController ChildSC in go.GetComponentsInChildren <ShaderController>())
     {
         HandleActivationGroup(ChildSC.gameObject, TreeLevelAC, ChildSC);
     }
 }
        public void LoadActivationTest()
        {
            ActivationController controller = new ActivationController();
            List <Activation>    result     = controller.Get() as List <Activation>;

            Assert.IsNotNull(result);
        }
        public void UpdateActivationTest()
        {
            // Arrange
            ActivationController controller  = new ActivationController();
            List <Activation>    activations = (List <Activation>)controller.Get();
            Activation           Activation  = activations.FirstOrDefault(c => c.ActivationCode == "aaaaaa");

            Activation.ActivationCode = "xgfhdd";
            Assert.AreNotEqual(0, controller.Put(Activation.Id, Activation));
        }
        public void InsertActivationTest()
        {
            ActivationController controller  = new ActivationController();
            QuestionController   qcontroller = new QuestionController();
            Question             question    = qcontroller.Get().Last();
            Activation           activation  = new Activation {
                StartDate = DateTime.Now, EndDate = DateTime.Now, ActivationCode = "cccccc", QuestionId = question.Id
            };

            Assert.AreNotEqual(0, controller.Post(activation));
        }
Exemplo n.º 5
0
    private void HandleActivationGroup(GameObject go, ActivationController myAC, ShaderController mySC)
    {
        mySC.shouldColor    = false;
        mySC.shouldVertex   = false;
        mySC.shouldDissolve = false;
        mySC.shouldSize     = false;

        switch (myAC.myGroup)
        {
        case ActivationController.Group.Zero:
            masterObjectList[0].Add(go);
            break;

        case ActivationController.Group.One:
            masterObjectList[1].Add(go);
            break;

        case ActivationController.Group.Two:
            masterObjectList[2].Add(go);
            break;

        case ActivationController.Group.Three:
            masterObjectList[3].Add(go);
            break;

        case ActivationController.Group.Four:
            masterObjectList[4].Add(go);
            break;

        case ActivationController.Group.Five:
            masterObjectList[5].Add(go);
            break;

        case ActivationController.Group.Six:
            masterObjectList[6].Add(go);
            break;

        case ActivationController.Group.Seven:
            masterObjectList[7].Add(go);
            break;

        case ActivationController.Group.Eight:
            masterObjectList[8].Add(go);
            break;

        case ActivationController.Group.Nine:
            masterObjectList[9].Add(go);
            break;
        }
    }
Exemplo n.º 6
0
    // Start is called before the first frame update
    void Start()
    {
        //Debug.Log(onset_array);
        //rend = GetComponent<Renderer>();
        LoadGameData();
        audioSource = GetComponent <AudioSource>();

        for (int i = 0; i < 10; i++)
        {
            masterObjectList.Add(new List <GameObject>());
        }
        Debug.Log(masterObjectList);


        GameObject[] allObjects = UnityEngine.Object.FindObjectsOfType <GameObject>();
        foreach (GameObject go in allObjects)
        {
            ActivationController myAC = go.GetComponent <ActivationController>();
            ShaderController     mySC = go.GetComponent <ShaderController>();

            if (go.tag == "Tree" && myAC)
            {
                HandleTreeActivationGroup(go, myAC);
                continue;
            }

            if (myAC && mySC && go.activeInHierarchy)
            {
                HandleActivationGroup(go, myAC, mySC);
            }
        }

        Debug.Log("GROUP ZER0:");
        foreach (GameObject go in masterObjectList[0])
        {
            Debug.Log(go);
        }

        Debug.Log("GROUP One:");
        foreach (GameObject go in masterObjectList[1])
        {
            Debug.Log(go);
        }

        //Debug.Log("GROUP Two:");
        //foreach (GameObject go in masterObjectList[2])
        //    Debug.Log(go);
    }
Exemplo n.º 7
0
        public void CheckLogin()
        {
            if (ctx.viewer.IsLogin)
            {
                echo("您有帐号,并且已经登录");
                return;
            }

            if (config.Instance.Site.LoginNeedImgValidation)
            {
                if (Html.Captcha.CheckError(ctx))
                {
                    run(Login);
                    return;
                }
            }

            String user = ctx.Post("txtUid");
            String pwd  = ctx.Post("txtPwd");

            if (strUtil.IsNullOrEmpty(user))
            {
                errors.Add(lang("exUserName"));
            }
            if (strUtil.IsNullOrEmpty(pwd))
            {
                errors.Add(lang("exPwd"));
            }
            if (errors.HasErrors)
            {
                run(Login); return;
            }

            User member = userService.IsNameEmailPwdCorrect(user, pwd);

            if (member == null)
            {
                errors.Add(lang("exUserNamePwdError"));
                run(Login);
                return;
            }

            if (userService.IsUserDeleted(member))
            {
                errors.Add(lang("exUsere"));
                run(Login);
                return;
            }

            if (config.Instance.Site.UserNeedApprove && member.Status == MemberStatus.Approving)
            {
                errors.Add("您的账号尚未经过审核,请耐心等候");
                run(Login);
                return;
            }

            // 需要激活才能登录
            if (member.IsEmailConfirmed == 0 && config.Instance.Site.LoginType == LoginType.ActivationEmail)
            {
                ActivationController.AllowSendActivationEmail(ctx, member.Id);
                redirect(new ActivationController().SendEmailButton);
                return;
            }

            LoginTime expiration;

            if (ctx.PostIsCheck("RememberMe") == 1)
            {
                expiration = LoginTime.Forever;
            }
            else
            {
                expiration = LoginTime.Never;
            }

            loginService.Login(member, expiration, ctx.Ip, ctx);

            //echoToParent( lang( "loginok" ), getSavedReturnUrl() );
            echoRedirect(lang("loginok"), getSavedReturnUrl());
        }
Exemplo n.º 8
0
 public void InsertResponseTest()
 {
     ActivationController controller  = new ActivationController();
     QuestionController   qcontroller = new QuestionController();
 }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        completeBlockSize = new Vector2((blockSize.x + streetWidth) * houseSize.x, (blockSize.y + streetWidth) * houseSize.y);

        for (int y = 0; y < size.y; y++)
        {
            for (int x = 0; x < size.x; x++)
            {
                for (int by = 0; by < blockSize.y; by++)
                {
                    for (int bx = 0; bx < blockSize.x; bx++)
                    {
                        Instantiate(house, new Vector3(start.x + x * (completeBlockSize.x) + (bx + 0.5f) * houseSize.x,
                                                       Random.value * (houseYOffset.y - houseYOffset.x) + houseYOffset.x,
                                                       start.y + y * (completeBlockSize.y) + (by + 0.5f) * houseSize.y), Quaternion.identity);

                        if (by == 0 && y > 0)
                        {
                            Instantiate(streetHorizontal, new Vector3(start.x + x * (completeBlockSize.x) + (bx + 0.5f) * houseSize.x,
                                                                      streetHeight,
                                                                      start.y + y * (completeBlockSize.y) - 0.5f * streetWidth * houseSize.y), Quaternion.identity);
                        }
                    }
                    if (x > 0)
                    {
                        Instantiate(streetVertical, new Vector3(start.x + x * (completeBlockSize.x) - 0.5f * streetWidth * houseSize.x,
                                                                streetHeight,
                                                                start.y + y * (completeBlockSize.y) + (by + 0.5f) * houseSize.y), Quaternion.identity);
                    }
                }
                if (x > 0 && y > 0)
                {
                    Instantiate(streetCross, new Vector3(start.x + x * (completeBlockSize.x) - 0.5f * streetWidth * houseSize.x,
                                                         streetHeight,
                                                         start.y + y * (completeBlockSize.y) - 0.5f * streetWidth * houseSize.y), Quaternion.identity);

                    Vector3[] dir          = { Vector3.forward, Vector3.left, Vector3.back, Vector3.right };
                    float[]   offX         = { -0.25f, 0.75f, 1.25f, 0.25f };
                    float[]   offY         = { 0.25f, -0.25f, 0.75f, 1.25f };
                    int       startTraffic = Random.Range(0, 4);
                    for (int i = 0; i < 4; i++)
                    {
                        Transform go = Instantiate(trafficLight, new Vector3(start.x + x * (completeBlockSize.x) - offX[i] * streetWidth * houseSize.x,
                                                                             trafficLightHeight,
                                                                             start.y + y * (completeBlockSize.y) - offY[i] * streetWidth * houseSize.y),
                                                   Quaternion.LookRotation(dir[i], Vector3.up)) as Transform;
                        go.GetComponent <TrafficLightControl>().startAfter = ((i + startTraffic) % 4) * trafficLightCycle;
                    }
                }
            }
        }

        for (int i = 0; i < carCount; i++)
        {
            int col, row;
            col = Random.Range(1, (int)size.x);
            row = Random.Range(1, (int)size.y);

            Transform go = Instantiate(randCar, new Vector3(col * completeBlockSize.x - (streetWidth / 2) * houseSize.x + start.x,
                                                            0,
                                                            row * completeBlockSize.y - (streetWidth / 2) * houseSize.y + start.y), Quaternion.identity) as Transform;

            go.GetComponent <RandCarController>().generator    = this;
            go.GetComponent <ExplosionController>().varManager = varManager;
            ActivationController.DeactivateChildren(go.gameObject, false, true);
        }

        for (int i = 0; i < enemyCount; i++)
        {
            int col, row;
            col = Random.Range(1, (int)size.x);
            row = Random.Range(1, (int)size.y);

            Transform go = Instantiate(enemyCar, new Vector3(col * completeBlockSize.x - (streetWidth / 2) * houseSize.x + start.x,
                                                             0,
                                                             row * completeBlockSize.y - (streetWidth / 2) * houseSize.y + start.y), Quaternion.identity) as Transform;

            go.GetComponent <EnemyCarController>().hero        = hero;
            go.GetComponent <EnemyCarController>().generator   = this;
            go.GetComponent <ExplosionController>().varManager = varManager;
            ActivationController.DeactivateChildren(go.gameObject, false, true);
        }

        hero.position = new Vector3(start.x + heroStart.x * (completeBlockSize.x) - (streetWidth / 2) * houseSize.x,
                                    0,
                                    start.y + heroStart.y * (completeBlockSize.y) - (streetWidth / 2) * houseSize.y);

        if (cam != null)
        {
            cam.position = hero.position;
        }

        if (varManager != null)
        {
            varManager.EnemyCount += enemyCount;
            varManager.updateText();
        }
    }