void Awake()
 {
     AddHandlerReceiveEvent(this);//注册
     _uicontrol = new m_UIControl();
     _main      = new mainControl();
     _bp        = new m_bpControl();
     _uicontrol.AddLoginEvent(_loginEventCallBack);
     _main._mainPanelEvent += _showBackpack;
     // _uicontrol.OnRegister += _onRegister;
     _showLogin();
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        //system init
        cnt = 0;

        //system
        mainCtr = GameObject.Find("mainControl");
        mc      = mainCtr.GetComponent <mainControl> ();
        //system ball num inc
        mc.incBall();

        //ball xy init
//		xx = 0.1f;	//固定の場合
//		yy = 0.1f;	//固定の場合
        xx = 0.05f + Random.Range(0.0f, 0.1f);
        yy = 0.05f + Random.Range(0.0f, 0.1f);
        if (Random.Range(0, 2) < 1)
        {
            xx = xx - (xx * 2);
        }
        if (Random.Range(0, 2) < 1)
        {
            yy = yy - (yy * 2);
        }

        //ball stop time init
        stopcnt = 40;

        //ball size
        ballxs = (this.GetComponent <SpriteRenderer> ().bounds.size.x) / 2;
        ballys = (this.GetComponent <SpriteRenderer> ().bounds.size.y) / 2;

        //ball transform cash
        cashTransform = transform;

        //ball audio
        se = GetComponent <AudioSource>();

        //ball anim
        animt       = GetComponent <Animator>();
        animt.speed = 0.8f;

        //ball sprite renderer
        sr = GetComponent <SpriteRenderer>();

        //ball rigidbody2d
        r2 = GetComponent <Rigidbody2D>();

        //collider at stop
        r2.bodyType = RigidbodyType2D.Kinematic;

        //ball scale
        scl = 1.0f;

        //ball color init
        colR  = 1.0f;
        colG  = 1.0f;
        colB  = 1.0f;
        colA  = 1.0f;
        colRR = 0.01f + Random.Range(0.0f, 0.03f);
        colGG = 0.01f + Random.Range(0.0f, 0.03f);
        colBB = 0.01f + Random.Range(0.0f, 0.03f);
        colAA = 0.01f + Random.Range(0.0f, 0.03f);
        if (Random.Range(0, 2) < 1)
        {
            colRR = colRR - (colRR * 2);
        }
        if (Random.Range(0, 2) < 1)
        {
            colGG = colGG - (colGG * 2);
        }
        if (Random.Range(0, 2) < 1)
        {
            colBB = colBB - (colBB * 2);
        }
        if (Random.Range(0, 2) < 1)
        {
            colAA = colAA - (colAA * 2);
        }

        //adforce doing flag
        doadf = false;

        //wall
        this.wall_u = GameObject.Find("wall_u");
        this.wall_d = GameObject.Find("wall_d");
        this.wall_l = GameObject.Find("wall_l");
        this.wall_r = GameObject.Find("wall_r");

        //wall size
        wall_uys = (wall_u.GetComponent <SpriteRenderer> ().bounds.size.y) / 2;
        wall_dys = (wall_d.GetComponent <SpriteRenderer> ().bounds.size.y) / 2;
        wall_lxs = (wall_l.GetComponent <SpriteRenderer> ().bounds.size.x) / 2;
        wall_rxs = (wall_r.GetComponent <SpriteRenderer> ().bounds.size.x) / 2;

        //wall transform cash
        cashTransformWall_u = wall_u.transform;
        cashTransformWall_d = wall_d.transform;
        cashTransformWall_l = wall_l.transform;
        cashTransformWall_r = wall_r.transform;
    }