Esempio n. 1
0
    public static IEnumerator ShareBattleResult(string type)
    {
        int    w        = Screen.width * 50 / 640;
        int    h        = Screen.height * 57 / 360;
        Rect   rect     = new Rect(w, h, Screen.width - w * 2, Screen.height - h * 2);
        string filepath = Application.persistentDataPath + "/battleresult.png";

        Texture2D screenShot = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.RGB24, false);

        //只在每一帧渲染完成后才读取屏幕信息
        yield return(new WaitForEndOfFrame());

        //读取屏幕像素信息并存储为纹理数据
        screenShot.ReadPixels(rect, 0, 0);
        screenShot.Apply();// 这一句必须有,像素信息并没有保存在2D纹理贴图中

        //读取将这些纹理数据,成一个png图片文件
        byte[] bytes = screenShot.EncodeToPNG();
        //写入文件 并且指定路径,因为使用该函数写入文件,同名的文件会被覆盖,所以,在路径中使用Time.time只是为了不出现同名文件而已, 没有什么实际的意义,只是当作个测试
        File.WriteAllBytes(filepath, bytes);

        //分享
        if (type == "wxtimeline")
        {
            PlatformDifferences.WXShareToTimeline("", "", "", filepath);
        }
        else if (type == "wxsession")
        {
            PlatformDifferences.WXShare("", "", "", filepath);
        }
        else
        {
            PlatformDifferences.QQShare("", "", "", filepath);
        }
    }
Esempio n. 2
0
 void LoginEvent(GameObject g)
 {
     User_Service.Login(IptLoginPhone.text, IptLoginPsw.text, PlatformDifferences.GetPushClientID(), t =>
     {
         EUser user = t.GetData() as EUser;
         OnLoginServerBack(user);
     });
 }
Esempio n. 3
0
 void OnGetUserInfoComplated(string name, string face)
 {
     User_Service.PlatformLogin(OpenID, name, face
                                , PlatformDifferences.GetPushClientID(), t =>
     {
         EUser user = t.GetData() as EUser;
         OnLoginServerBack(user);
     });
 }
Esempio n. 4
0
 void OnAddFileClicked(GameObject g)
 {
     PlatformDifferences.OpenFile();
 }
Esempio n. 5
0
 void OnPayEvent(GameObject sender)
 {
     string[] nn = sender.name.Split('_');
     PlatformDifferences.JFTPay(GlobalVariable.LoginUser.ID.ToString(), nn[1], (System.Convert.ToInt32(nn[2]) / 100.0f).ToString());
 }
Esempio n. 6
0
 void OnBtnInviteFriendClicked(GameObject sender)
 {
     SoundManager.Instance.PlaySound("音效/按钮");
     PlatformDifferences.QQShare("一起来玩吧", "卡五梅", "http://www.baidu.com", "http://img3.cache.netease.com/photo/0005/2013-03-07/8PBKS8G400BV0005.jpg");
 }
Esempio n. 7
0
 void UploadProjectFace(GameObject g)
 {
     PlatformDifferences.OpenPhoto(true, 200, 200);
 }
Esempio n. 8
0
 void OnUploadFace(GameObject g)
 {
     PlatformDifferences.OpenPhoto(true, 150, 150);
 }
Esempio n. 9
0
 void onQQYQ(GameObject g)
 {
     PlatformDifferences.QQShare(Session.CurrentUser.Name + "邀请你加入团队", "", "http://shouji.baidu.com/software/10526673.html", "http://47.90.21.98:8080/Images/lemon.png");
 }
Esempio n. 10
0
 void BtnShareQQButtonClicked(GameObject sender)
 {
     SoundManager.Instance.PlaySound("音效/按钮");
     PlatformDifferences.QQShare("快来一起玩吧", "房间号" + BattleCode.text, "http://www.kawumei.com/", "http://www.kawumei.com/");
 }
Esempio n. 11
0
 void OnLoginComplated(string openid)
 {
     OpenID = openid;
     PlatformDifferences.GetUserInfo();
 }
Esempio n. 12
0
 void LoginQQEvent(GameObject g)
 {
     PlatformDifferences.Login();
 }
Esempio n. 13
0
 void LoginWXEvent(GameObject g)
 {
     PlatformDifferences.Login("wxLogin");
     SoundManager.Instance.PlaySound("音效/按钮");
 }