示例#1
0
    // Use this for initialization
    void Start()
    {
        FlurryTAd.ShowTAd(true);

        startTime = Time.time;

        uiPos = new TrinitiUIPosition();
        //texPos = new StartMenuTexturePosition();


        m_UIManager = gameObject.AddComponent <UIManager>() as UIManager;
        m_UIManager.SetParameter(8, 1, false);
        m_UIManager.CLEAR = true;

        trinitiMaterial = UIResourceMgr.GetInstance().GetMaterial("yuyue");
        background      = new UIImage();
        background.SetTexture(trinitiMaterial, StartMenuTexturePosition.Background, new Vector2(Screen.width, Screen.height));
        background.Rect = AutoRect.AutoPos(uiPos.Background);

        //! background.Rect = new Rect(0, 0, Screen.width, Screen.height);


        m_UIManager.Add(background);

        GameCenterInterface.Login();
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        ResolutionConstant.R = ((float)Screen.width) / 960f;
        UIResourceMgr.GetInstance().LoadStartMenuUIMaterials();    //! 加载开始菜单需要的材质


        uiPos = new StartMenuUIPosition();
        //texPos = new StartMenuTexturePosition();

        //! UIManager
        m_UIManager = gameObject.AddComponent <UIManager>() as UIManager;
        m_UIManager.SetParameter(8, 1, false);
        m_UIManager.SetUIHandler(this);                     //! HandleEvent
        m_UIManager.CLEAR = true;

        startMenuMaterial = UIResourceMgr.GetInstance().GetMaterial("StartMenu");      //! StartMenu 材质
        //startMenu2Material = UIResourceMgr.GetInstance().GetMaterial("StartMenu2");
        Material buttonsMaterial = UIResourceMgr.GetInstance().GetMaterial("Buttons"); //! Button材质

        background = new UIImage();
        background.SetTexture(startMenuMaterial, StartMenuTexturePosition.Background, AutoRect.AutoSize(StartMenuTexturePosition.Background));
        background.Rect = AutoRect.AutoPos(uiPos.Background);


        startButton = new UITextButton();
        startButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                               ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        startButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                               ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));

        startButton.Rect = AutoRect.AutoPos(uiPos.StartButton);
        startButton.SetText(ConstData.FONT_NAME1, " NEW GAME", ColorName.fontColor_orange);

        continueButton = new UITextButton();
        continueButton.SetTexture(UIButtonBase.State.Normal, buttonsMaterial,

                                  ButtonsTexturePosition.ButtonNormal, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));
        continueButton.SetTexture(UIButtonBase.State.Pressed, buttonsMaterial,

                                  ButtonsTexturePosition.ButtonPressed, AutoRect.AutoSize(ButtonsTexturePosition.MiddleSizeButton));

        continueButton.Rect = AutoRect.AutoPos(uiPos.ContinueButton);

        continueButton.SetText(ConstData.FONT_NAME1, " CONTINUE", ColorName.fontColor_orange);



        gameDialog = new GameDialog(UIDialog.DialogMode.YES_OR_NO);
        gameDialog.SetText(ConstData.FONT_NAME2, "\n\nAre You Sure You Want To Erase Your Progress And Start A New Game?", ColorName.fontColor_darkorange);
        gameDialog.SetDialogEventHandler(this);


        m_UIManager.Add(background);
        m_UIManager.Add(startButton);
        m_UIManager.Add(continueButton);

        m_UIManager.Add(gameDialog);

        GameApp.GetInstance().Init();
        GameCenterInterface.Login();

        string path = Application.dataPath + "/../../Documents/";

        if (File.Exists(path + "MySavedGame.game"))
        {
        }
        else
        {
            continueButton.Visible = false;
            continueButton.Enable  = false;
        }

        FlurryTAd.ShowTAd(true);
    }