private void OnRander(int index, GObject go)
    {
        Dictionary <string, object> _data = (Dictionary <string, object>)dic [index];

        go.asCom.GetController("c1").selectedIndex = (int)_data ["st"] == 0 ? 1 : 0;
        GComponent nm;
        GTextField txt;
        GTextField name;
        GTextField time;
        DateTime   times = (DateTime)_data["time"];
        GButton    head;

        if ((int)_data ["st"] == 0)
        {
            nm   = go.asCom.GetChild("n1").asCom;
            txt  = nm.GetChild("n2").asTextField;
            name = nm.GetChild("n1").asTextField;
            time = nm.GetChild("n4").asTextField;
            head = nm.GetChild("n0").asButton;

            name.text = userModel.GetUName();
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(userModel.head ["use"].ToString()));
            txt.text = _data ["content"].ToString();
        }
        else
        {
            nm   = go.asCom.GetChild("n0").asCom;
            txt  = nm.GetChild("n2").asTextField;
            name = nm.GetChild("n1").asTextField;
            time = nm.GetChild("n4").asTextField;
            head = nm.GetChild("n0").asButton;
            Tools.SetLoaderButtonUrl(head, ModelUser.GetHeadUrl(DataManager.inst.systemSimple ["service_icon"].ToString(), true));
            txt.text  = _data ["content"].ToString().Split('|') [1];
            name.text = kefuName;
        }
        Tools.DataTimeFormat(time, times, 0);
        //		time.text = times.ToString ();
        //if (txt.textHeight > 31)
        //{
        //nm.GetChild("n5").height = 49;
        //float c = txt.textHeight - 31;
        //nm.GetChild("n5").height = nm.GetChild("n5").height + c;
        //go.height = (90 - 31) + txt.textHeight + 10;
        //			it.GetChild ("n4").y = it.GetChild ("n4").y + c;
        go.height = txt.y + txt.textHeight + 40 + 30;

        nm.GetChild("n5").height = txt.textHeight + 33;

        time.y = nm.GetChild("n5").y + nm.GetChild("n5").height + 10;
        //}
        //else
        //{
        //    go.height = 115 + 10;
        //    //			it.GetChild ("n4").y = 90;
        //}
    }
Exemple #2
0
    public override void Init()
    {
        GRoot.inst.touchable = false;
        base.Init();
        this.Create(Config.VIEW_AD);
        //
        fightData  = this.GetChild("n0").asImage;
        ad         = this.GetChild("n10").asImage;
        isFight    = (typeAd == ModelShare.SHARE_FIGHT);
        ad.visible = !isFight;
        //
        killAll  = this.GetChild("n3").asTextField;
        killPass = this.GetChild("n4").asTextField;
        hertAll  = this.GetChild("n5").asTextField;
        score    = this.GetChild("n6").asTextField;
        name     = this.GetChild("n7").asTextField;
        QRcode   = this.GetChild("n8").asLoader;
        //
        //

        GameObject cutCamera = new GameObject();

        cutCamera.name = "cutCamera";
        Vector3 mCa = StageCamera.main.transform.localPosition;

        camera                         = cutCamera.AddComponent <Camera> ();
        camera.clearFlags              = CameraClearFlags.SolidColor;
        camera.farClipPlane            = StageCamera.main.farClipPlane;
        camera.nearClipPlane           = StageCamera.main.nearClipPlane;
        camera.orthographic            = true;
        camera.depth                   = StageCamera.main.depth - 1;
        camera.orthographicSize        = StageCamera.main.orthographicSize;
        camera.backgroundColor         = Color.white;
        camera.transform.localPosition = new Vector3(-mCa.x, mCa.y, 0);
        camera.useOcclusionCulling     = false;
        //
        float nw = (this.width / this.height) * GRoot.inst.height;

        this.height = GRoot.inst.height;
        this.width  = nw;
        //
        this.group.x = -(GRoot.inst.width * 0.5f) - (this.width * 0.5f);
        this.group.y = 0;
//		Debug.LogError(":: >> "+this.view.width+" | "+this.view.actualWidth+" | "+this.view.viewWidth + " | "+GRoot.inst.scale.y.ToString());
        //
        userModel  = ModelManager.inst.userModel;
        shareModel = ModelManager.inst.shareModel;
        fightModel = ModelManager.inst.fightModel;
        //
        if (isFight)
        {
            object[] arr         = (object[])fightModel.fightData["my_data"];
            bool     isNotCustom = false;
            if (arr [0] is object[])
            {
                isNotCustom = true;
            }
//			Debug.Log (isNotCustom);
            if (isNotCustom)
            {
                score.text    = ((object[])arr [0]) [0] + "";
                killAll.text  = ((object[])arr [1]) [0] + "";
                killPass.text = ((object[])arr [2]) [0] + "";
                hertAll.text  = ((object[])arr [3]) [0] + "";
            }
            else
            {
                score.text    = (arr [0]) + "";
                killAll.text  = (arr [1]) + "";
                killPass.text = (arr [2]) + "";
                hertAll.text  = (arr [3]) + "";
            }
            name.text = userModel.GetUName();
        }
        //
        shareUrl = DataManager.inst.systemSimple["share_url"] + userModel.uid;
        //
        string qr = LocalStore.GetLocal(LocalStore.LOCAL_QRCODE + userModel.uid);

        if (qr != "" && qr != null && qr.Length > 0)
        {
            QRcode.texture = new NTexture(PhoneManager.inst.Base64ToTexter2d(qr, 150, 150));
            CutBitmap();
        }
        else
        {
            LoaderManager.inst.Load(shareUrl + ".jpg", (object w) => {
                if (this.group == null || this.parent == null)
                {
                    GRoot.inst.touchable = true;
                    return;
                }
                Texture2D topImage = (Texture2D)w;
                if (w != null && w != null && QRcode != null)
                {
                    if (this.group == null)
                    {
                        return;
                    }
                    QRcode.texture = new NTexture(topImage);
                    //				Log.debug("topImage:"+topImage);
                    //				Log.debug("erBg"+erBg);
                    LocalStore.SetLocal(LocalStore.LOCAL_QRCODE + userModel.uid, Convert.ToBase64String(topImage.EncodeToJPG()));
                    //				share_bitmap = ComposeImage(baseImage, topImage);
                    CutBitmap();
                }
            }, (object error) => {
                GRoot.inst.touchable = true;
            });
        }
    }