Example #1
0
 private Signal(GObject.Object obj, string signal_name, Delegate marshaler)
 {
     tref = obj.ToggleRef;
     name = signal_name;
     tref.Signals [name] = this;
     this.marshaler = marshaler;
 }
Example #2
0
 public Value(GObject.GType gtype)
 {
     type = IntPtr.Zero;
     pad1 = new Padding ();
     pad2 = new Padding ();
     g_value_init (ref this, gtype.Val);
 }
 public void Init(GObject gobj)
 {
     linked_gobj = gobj;
     grobj = linked_gobj.renderedGameObject.GetComponent<GRObject> ();
     initAnimClipPairs ();
     setDefaultAnims ();
 }
Example #4
0
    public MainPanel()
    {
        _view = UIPackage.CreateObject("Demo", "Demo").asCom;
        _view.fairyBatching = true;//优化drawcall,可以切换这条语句看效果
        _view.SetSize(GRoot.inst.width, GRoot.inst.height);
        _view.AddRelation(GRoot.inst, RelationType.Size);
        GRoot.inst.AddChild(_view);

        _backBtn = _view.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer = _view.GetChild("container").asCom;
        _cc = _view.GetController("c1");

        int cnt = _view.numChildren;
        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _view.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
                obj.onClick.Add(runDemo);
        }

        _demoObjects = new Dictionary<string, GComponent>();
    }
Example #5
0
 private Signal(GObject.Object obj, string signal_name, Type args_type)
 {
     tref = obj.ToggleRef;
     name = signal_name;
     this.args_type = args_type;
     tref.Signals [name] = this;
 }
Example #6
0
 public ToggleRef(GObject.Object target)
 {
     handle = target.Handle;
     gch = GCHandle.Alloc (this);
     reference = target;
     g_object_add_toggle_ref (target.Handle, ToggleNotifyCallback, (IntPtr) gch);
     g_object_unref (target.Handle);
 }
Example #7
0
 public void Deactivate()
 {
     StopListeners ();
     Reset ();
     UIManager.UI.destroySHP (gameObject);
     linked_gobject = null;
     assoc_shp = null;
 }
Example #8
0
 protected SignalCallback(GObject.Object obj, Delegate eh, System.Type argstype)
 {
     _key = _NextKey++;
     _obj = obj;
     _handler = eh;
     _argstype = argstype;
     _Instances [_key] = this;
 }
Example #9
0
 void RenderListItem(int index, GObject obj)
 {
     MailItem item = (MailItem)obj;
     item.setFetched(index % 3 == 0);
     item.setRead(index % 2 == 0);
     item.setTime("5 Nov 2015 16:24:33");
     item.title = index + " Mail title here";
 }
Example #10
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);

        _back = GetChild("n0");
        _front = GetChild("icon");
        _front.visible = false;
    }
Example #11
0
    public void StartDrag(GObject source, string icon, object sourceData, int touchPointID = -1)
    {
        if (_agent.parent != null)
            return;

        _sourceData = sourceData;
        _agent.url = icon;
        GRoot.inst.AddChild(_agent);
        Vector2 pt = source.LocalToGlobal(new Vector2(0, 0));
        _agent.SetXY(pt.x, pt.y);
        _agent.StartDrag(null, touchPointID);
    }
Example #12
0
 void Init(GObject obj)
 {
     linked_gobject = obj;
     addedComponents = new List<Component> ();
     addedGameObjects = new List<GameObject> ();
     if (obj.type != null) {
         Setup (obj.type);
     }
     else {
         Debug.LogError("GObject type is undefined.");
     }
 }
    void RenderListItem(int index, GObject obj)
    {
        GButton item = (GButton)obj;
        Message msg = _messages[index];
        if (!msg.fromMe)
            item.GetChild("name").text = msg.sender;
        item.icon = UIPackage.GetItemURL("EmojiPro", msg.senderIcon);

        //Recaculate the text width
        GRichTextField tf = item.GetChild("msg").asRichTextField;
        tf.emojies = _emojies;
        tf.width = tf.initWidth;
        tf.text = msg.msg;
        tf.width = tf.textWidth;
    }
Example #14
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/json";
     GObject obj = new GObject();
     obj.Add("name", "任肖").Add("age", "19").Add("desc", "你好爱上飞Y&*^*(67Y*(OIH*^_(*\"\n\tdd3").Add("sex", true).Add("day", DateTime.Now); ;
     GObjectList list = new GObjectList();
     for (int i = 0; i < 10; i++)
     {
         GObject obj1 = new GObject();
         obj1["name"] = "名字1";
         obj1["sex"] = false;
         obj1["day"] = DateTime.Now;
         list.Add(obj1);
     }
     obj["list"] = list;
     context.Response.Write(obj.GetJSON());
 }
    public JoystickModule(GComponent mainView)
    {
        onMove = new EventListener(this, "onMove");
        onEnd = new EventListener(this, "onEnd");

        _button = mainView.GetChild("joystick").asButton;
        _button.changeStateOnClick = false;
        _thumb = _button.GetChild("thumb");
        _touchArea = mainView.GetChild("joystick_touch");
        _center = mainView.GetChild("joystick_center");

        _InitX = _center.x + _center.width / 2;
        _InitY = _center.y + _center.height / 2;
        touchId = -1;
        radius = 150;

        _touchArea.onTouchBegin.Add(this.onTouchDown);
    }
Example #16
0
    /*
     *  Function: setupObject
     *
     *  Parameters: GObject:<obj>
     *
     * 	Returns: void
     *
     * 	-Obtains a new GameObject from the <objectPool>, which will be used to render <obj> .
     *  -Initializes the GameObjects attributes and links references between <obj> and the GameObject
     *  -Sets the GameObjects position.
     */
    public void setupObject(GObject obj)
    {
        GameObject robj = getNewGameObject ();
        obj.linkGameObject (robj);

        GRObject grobj = robj.GetComponent<GRObject> ();
        grobj.Activate (obj);
        //robj.GetComponent<SpriteRenderer> ().sprite = obj.sprite;
        //robj.GetComponent<Animator> ().runtimeAnimatorController = getAnimationController (obj);
        robj.transform.position = new Vector3 (
            (int)obj.pos_x,
            (int)obj.pos_y,
            GameRenderer.GRenderer.getZUnitsObject(obj.getPosition())
        );
        robj.name = obj.gameObjectName;

        //TESTS
        TestUtils.active_r_objs++;
    }
Example #17
0
        private void bArtem_Click(object sender, EventArgs e)
        {
            #region prepare
            chart1.Series[0].Points.Clear();
            double dT;
            double.TryParse(cbTR.Text, out dT);

            Console.WriteLine(GraphPoints.Count);
            hobj = new double[GraphPoints.Count];
            lobj = new double[GraphPoints.Count];
            time = new double[GraphPoints.Count];

            for (int i = 0; i < GraphPoints.Count; i++)
            {
                hobj[i] = GraphPoints[i].Z;
                lobj[i] = Math.Sqrt(Math.Pow(GraphPoints[i].X, 2.0) + Math.Pow(GraphPoints[i].Y, 2.0));
                time[i] = i * dT;
            }
            Array.Resize(ref Ray.Kz, Ray.Hz.Count - 1);
            Array.Clear(Ray.Kz, 0, Ray.Kz.Length);
            for (int i = 0; i < Ray.Kz.Length; i++)
            {
                if (Ray.Cz[i] == Ray.Cz[i + 1])
                {
                    Ray.Cz[i + 1] += 0.001;                                             // якщо швидкість стала, робимо коефіцієнт наближеним до нуля
                }
                Ray.Kz[i] = (Ray.Cz[i + 1] - Ray.Cz[i]) / (Ray.Hz[i + 1] - Ray.Hz[i]);  // обчислюємо коефіцієнти зміни швидкості звуку за глибиною
            }
            Array.Resize(ref Ray.Yr, Ray.Kz.Length);
            Array.Clear(Ray.Yr, 0, Ray.Yr.Length);
            for (int i = 0; i < Ray.Yr.Length; i++)                                     // обчислюємо ординати центрів кіл для кожного водного шару
            {
                Ray.Yr[i] = Ray.Cz[i] / Ray.Kz[i] - Ray.Hz[i];
            }


            GObject gObj = new GObject();

            List <double> timeRays = new List <double>();
            List <double> ampRaysX = new List <double>();
            List <double> ampRaysY = new List <double>();
            List <double> ampRaysZ = new List <double>();

            #endregion

            //for (int i = 0; i < GraphPoints.Count; i++)
            Parallel.For(0, GraphPoints.Count, (i) =>
            {
                List <double> tR   = new List <double>();
                List <double> aR   = new List <double>();
                List <double> angR = new List <double>();
                List <double> lR   = new List <double>();

                gObj.calcAmp(hobj[i], lobj[i], time[i], aR, tR, angR, lR);

                for (int j = 0; j < tR.Count; j++)
                {
                    timeRays.Add(Math.Round(tR[j] / dT) * dT + time[i]);
                    //double rxy = aR[j] * Math.Cos(angR[j]);
                    double rxy = aR[j] * Math.Cos(angR[j]) * Math.Sin(2 * Math.PI * Sr.Frequency * tR[j]);
                    ampRaysX.Add(rxy * GraphPoints[i].X / lobj[i]);
                    ampRaysY.Add(rxy * GraphPoints[i].Y / lobj[i]);
                    //ampRaysZ.Add(aR[j] * Math.Sin(angR[j]));
                    ampRaysZ.Add(aR[j] * Math.Sin(angR[j]) * Math.Sin(2 * Math.PI * Sr.Frequency * tR[j]));
                }
            });

            #region Graph
            int N = Math.Min(Math.Min(timeRays.Count, ampRaysX.Count), Math.Min(ampRaysY.Count, ampRaysZ.Count));
            for (int d = N / 2; d >= 1; d /= 2)
            {
                for (int i = d; i < N; i++)
                {
                    for (int j = i; j >= d && timeRays[j - d] > timeRays[j]; j -= d)
                    {
                        double rT = timeRays[j];
                        timeRays[j]     = timeRays[j - d];
                        timeRays[j - d] = rT;
                        rT              = ampRaysX[j];
                        ampRaysX[j]     = ampRaysX[j - d];
                        ampRaysX[j - d] = rT;
                        rT              = ampRaysY[j];
                        ampRaysY[j]     = ampRaysY[j - d];
                        ampRaysY[j - d] = rT;
                        rT              = ampRaysZ[j];
                        ampRaysZ[j]     = ampRaysZ[j - d];
                        ampRaysZ[j - d] = rT;
                    }
                }
            }
            List <double> resTime = new List <double>();
            List <double> resAmp  = new List <double>();
            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(string.Format("timeRays = {0}", i));
                if (i > 0 && timeRays[i - 1] == timeRays[i])
                {
                    continue;
                }
                double ampx = 0;
                double ampy = 0;
                double ampz = 0;
                for (int k = i; k < N; k++)
                {
                    if (timeRays[k] == timeRays[i])
                    {
                        ampx += ampRaysX[k];
                        ampy += ampRaysY[k];
                        ampz += ampRaysZ[k];
                    }
                }
                double amp0 = Math.Sqrt(ampx * ampx + ampy * ampy + ampz * ampz);
                resTime.Add(timeRays[i]);
                resAmp.Add(amp0);
            }
            for (int i = 0; i < resTime.Count; i++)
            {
                chart1.Series[0].Points.AddXY(resTime[i], resAmp[i]);
            }

            #endregion
        }
Example #18
0
 static extern void g_value_unset(ref GObject.Value val);
Example #19
0
 static extern void g_value_init(ref GObject.Value val, IntPtr gtype);
Example #20
0
    /// <summary>
    /// The rendertexture is not transparent. So if you want to the UI elements can be seen in the back of the models/particles in rendertexture,
    /// you can set a maximunm two images for background.
    /// </summary>
    /// <param name="image1"></param>
    /// <param name="image2"></param>
    public void SetBackground(GObject image1, GObject image2)
    {
        Image source1 = (Image)image1.displayObject;
        Image source2 = image2 != null ? (Image)image2.displayObject : null;

        Vector3 pos = this._background.position;

        pos.z = _camera.farClipPlane;
        this._background.position = pos;

        Mesh mesh = new Mesh();
        Rect rect = this._image.TransformRect(new Rect(0, 0, this._width, this._height), source1);

        source1.PrintTo(mesh, rect);

        Vector2[] tmp = mesh.uv;
        if (source2 != null)
        {
            rect = this._image.TransformRect(new Rect(0, 0, this._width, this._height), source2);
            source2.PrintTo(mesh, rect);

#if UNITY_5
            mesh.uv2 = mesh.uv;
#else
            mesh.uv1 = mesh.uv;
#endif
            mesh.uv = tmp;
        }

        Vector2[] tmp2 = new Vector2[tmp.Length];
        FairyGUI.Utils.ToolSet.uvLerp(tmp, tmp2, 0, 1);

        int       cnt   = tmp2.Length;
        Vector3[] verts = mesh.vertices;
        for (int i = 0; i < cnt; i++)
        {
            Vector2 v2 = tmp2[i];
            verts[i] = new Vector3(v2.x * 2 - 1, v2.y * 2 - 1);
        }
        mesh.vertices = verts;

        MeshFilter meshFilter = this._background.gameObject.GetComponent <MeshFilter>();
        if (meshFilter == null)
        {
            meshFilter = this._background.gameObject.AddComponent <MeshFilter>();
        }
        meshFilter.mesh = mesh;
        MeshRenderer meshRenderer = this._background.gameObject.GetComponent <MeshRenderer>();
        if (meshRenderer == null)
        {
            meshRenderer = this._background.gameObject.AddComponent <MeshRenderer>();
        }
#if UNITY_5
        meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
#else
        meshRenderer.castShadows = false;
#endif
        meshRenderer.receiveShadows = false;
        Shader   shader = Shader.Find("Game/FullScreen");
        Material mat    = new Material(shader);
        mat.mainTexture = source1.texture.nativeTexture;
        if (source2 != null)
        {
            mat.SetTexture("_Tex2", source2.texture.nativeTexture);
        }
        meshRenderer.material = mat;
    }
Example #21
0
    private void __clickMenu(EventContext context)
    {
        GObject itemObject = (GObject)context.data;

        UnityEngine.Debug.Log("click " + itemObject.text);
    }
Example #22
0
 /*
  *  Function: updateObjectPosition
  *
  *  Parameters: GObject:<obj>
  *
  * 	Returns: void
  *
  * 	-Sets <obj>s rendered GameObjects position.
  */
 public void updateObjectPosition(GObject obj)
 {
     obj.renderedGameObject.transform.position = new Vector3(
         (int)obj.pos_x,
         (int)obj.pos_y,
         GameRenderer.GRenderer.getZUnitsObject(obj.getPosition())
     );
 }
Example #23
0
 /*
  *  Function: discardObject
  *
  *  Parameters: GObject:<obj>
  *
  * 	Returns: void
  *
  * 	-Returns <obj>s rendered GameObject to the <objectPool>.
  *  -Unlinks references between <obj> and the GameObject
  */
 public void discardObject(GObject obj)
 {
     discardGameObject (obj.renderedGameObject);
     obj.unlinkGameObject ();
 }
Example #24
0
    private void SearchRander(int index, GObject item)
    {
        GComponent comPhoto       = item.asCom.GetChild("n1").asCom;
        GButton    photo          = comPhoto.GetChild("n0").asButton;
        GTextField name           = item.asCom.GetChild("n3").asTextField;
        GTextField guild          = item.asCom.GetChild("n4").asTextField;
        GObject    rank           = item.asCom.GetChild("n21");
        GTextField rankScore      = rank.asCom.GetChild("n2").asTextField;
        GLoader    achieve        = rank.asCom.GetChild("n1").asLoader;
        GTextField status         = item.asCom.GetChild("n9").asTextField;
        GButton    mask_btn       = item.asCom.GetChild("n8").asButton;
        GButton    btn_attention  = item.asCom.GetChild("n7").asButton;
        GTextField attention_text = btn_attention.GetChild("title").asTextField;
        GLoader    btn_image      = btn_attention.asCom.GetChild("n1").asLoader;
        GObject    reletion       = item.asCom.GetChild("n2");
        GButton    more           = item.asCom.GetChild("n10").asButton;
        GTextField lv             = item.asCom.GetChild("n1").asCom.GetChild("n2").asTextField;
        GGroup     itemBtn        = item.asCom.GetChild("item").asGroup;

        //GImage bg = item.asCom.GetChild("n0").asImage;
        more.text = Tools.GetMessageById("13078");


        bool isVisible = SetListCSS(item, listData.ToArray(), index);

        if (isVisible)
        {
            Dictionary <string, object> dc = (Dictionary <string, object>)listData[index];

            more.visible      = false;
            rankScore.visible = true;
            reletion.visible  = false;
            rank.visible      = true;
            int uid = (int)dc["uid"];
            if (uid == -1)
            {
                //            bg.visible = false;
                lv.visible       = false;
                comPhoto.visible = false;
                name.visible     = false;
                guild.visible    = false;
                achieve.visible  = false;
                status.visible   = false;
                //mask_btn.visible = false;
                more.visible          = true;
                btn_attention.visible = false;
                rank.visible          = false;
                more.onClick.Add(() =>
                {
                    if (Convert.ToInt32(dc["type"]) == 1)
                    {
                        ViewManager.inst.ShowText(Tools.GetMessageById("13043"));
                    }
                    else
                    {
                        GetNearData(1, item);
                    }
                });
            }
            else
            {
                lv.visible       = true;
                comPhoto.visible = true;
                name.visible     = true;
                guild.visible    = true;
                userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);
                achieve.visible = true;
                status.visible  = true;
                //mask_btn.visible = true;
                btn_attention.visible = true;
                more.visible          = false;
                btn_attention.RemoveEventListeners();
                btn_attention.onClick.Add(() =>
                {
                    //关注的实现
                    Dictionary <string, object> dd = new Dictionary <string, object>();
                    dd["fuid"] = dc["uid"];
                    NetHttp.inst.Send(NetBase.HTTP_FOLLOW, dd, (VoHttp vo) =>
                    {
                        if ((bool)vo.data == true)
                        {
                            roleModel.AddAttentionFight(dc["uid"].ToString());
                            //ViewManager.inst.ShowText(Tools.GetMessageById("13045"));
                            ((Dictionary <string, object>)listData[index])["if_follow"] = true;
                            Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);
                            btn_attention.touchable = false;
                            //                        btn_image.url = Tools.GetResourceUrl("Image:btn_page3");
                            btn_attention.RemoveEventListeners();
                        }
                        else
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("13120"));
                        }
                    });
                });
                if ((bool)dc["if_black"])
                {//是否拉黑
                    Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textShieldd, fontSize, textBtnColor, "", 0);

                    type = 1;
                    btn_attention.touchable = false;
                }
                else if ((bool)dc["if_follow"])
                {
                    Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);

                    type = 2;
                    btn_attention.touchable = false;
                    //                btn_image.url = Tools.GetResourceUrl("Image:btn_page3");
                }
                else
                {
                    Tools.SetButtonBgAndColor(btn_attention, btnBgUp, textAttention, fontSize, textBtnColor, textBtnStrokeColor);

                    btn_attention.touchable = true;
                }
                achieve.url = userModel.GetRankImg((int)dc["rank_score"]);
                status.text = Tools.GetNearDistance((int)dc["dis"]);
                mask_btn.RemoveEventListeners();
                mask_btn.onClick.Add(() =>
                {
                    if (!more.visible)
                    {
                        roleModel.SetTempData(listData, new int[] { list.GetFirstChildInView(), tag_n, dataPreNum });
                        string uid_ = dc["uid"] + "";
                        if (!uid_.Equals(userModel.uid))
                        {
                            this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, uid_, roleModel.tab_CurSelect1, roleModel.tab_CurSelect2, roleModel.tab_CurSelect3 }));
                        }
                        else
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
                        }
                    }
                });

                lv.text = dc["lv"].ToString();

                string uname = dc["uname"] + "";
                if (uname.Equals(""))
                {
                    name.text = dc["uid"] + "";
                }
                else
                {
                    name.text = uname;
                }
                string dc_ = (string)dc["head_use"];
                Tools.SetLoaderButtonUrl(photo, ModelUser.GetHeadUrl(dc_));
                if (dc["guild_name"] == null)
                {
                    guild.text = Tools.GetMessageById("19955");
                }
                else
                {
                    guild.text = dc["guild_name"] + "";
                }
                rankScore.text = dc["rank_score"] + "";
            }
        }
        else
        {
            btn_attention.visible = false;
        }
    }
Example #25
0
    /// <summary>
    /// The rendertexture is not transparent. So if you want to the UI elements can be seen in the back of the models/particles in rendertexture,
    /// you can set a maximunm two images for background.
    /// </summary>
    /// <param name="image1"></param>
    /// <param name="image2"></param>
    public void SetBackground(GObject image1, GObject image2)
    {
        Image source1 = (Image)image1.displayObject;
        Image source2 = image2 != null ? (Image)image2.displayObject : null;

        Vector3 pos = this._background.position;
        pos.z = _camera.farClipPlane;
        this._background.position = pos;

        Mesh mesh = new Mesh();
        Rect rect = this._image.TransformRect(new Rect(0, 0, this._width, this._height), source1);
        source1.PrintTo(mesh, rect);

        Vector2[] tmp = mesh.uv;
        if (source2 != null)
        {
            rect = this._image.TransformRect(new Rect(0, 0, this._width, this._height), source2);
            source2.PrintTo(mesh, rect);

        #if UNITY_5
            mesh.uv2 = mesh.uv;
        #else
            mesh.uv1 = mesh.uv;
        #endif
            mesh.uv = tmp;
        }

        Vector2[] tmp2 = new Vector2[tmp.Length];
        FairyGUI.Utils.ToolSet.uvLerp(tmp, tmp2, 0, 1);

        int cnt = tmp2.Length;
        Vector3[] verts = mesh.vertices;
        for (int i = 0; i < cnt; i++)
        {
            Vector2 v2 = tmp2[i];
            verts[i] = new Vector3(v2.x * 2 - 1, v2.y * 2 - 1);
        }
        mesh.vertices = verts;

        MeshFilter meshFilter = this._background.gameObject.GetComponent<MeshFilter>();
        if (meshFilter == null)
            meshFilter = this._background.gameObject.AddComponent<MeshFilter>();
        meshFilter.mesh = mesh;
        MeshRenderer meshRenderer = this._background.gameObject.GetComponent<MeshRenderer>();
        if (meshRenderer == null)
            meshRenderer = this._background.gameObject.AddComponent<MeshRenderer>();
        #if UNITY_5
        meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        #else
        meshRenderer.castShadows = false;
        #endif
        meshRenderer.receiveShadows = false;
        Shader shader = Shader.Find("Game/FullScreen");
        Material mat = new Material(shader);
        mat.mainTexture = source1.texture.nativeTexture;
        if (source2 != null)
            mat.SetTexture("_Tex2", source2.texture.nativeTexture);
        meshRenderer.material = mat;
    }
Example #26
0
 void IBattleElement.AttachElement(GObject el)
 {
     OnAttachElement(el);
 }
Example #27
0
    private void TasteRander(int index, GObject item)
    {
        Dictionary <string, object> dc = (Dictionary <string, object>)listData [index];
        GButton    photo          = item.asCom.GetChild("n1").asCom.GetChild("n0").asButton;
        GTextField name           = item.asCom.GetChild("n3").asTextField;
        GTextField guild          = item.asCom.GetChild("n4").asTextField;
        GLoader    achieve        = item.asCom.GetChild("n21").asCom.GetChild("n1").asLoader;
        GTextField status         = item.asCom.GetChild("n9").asTextField;
        GButton    mask_btn       = item.asCom.GetChild("n8").asButton;
        GButton    btn_attention  = item.asCom.GetChild("n7").asButton;
        GTextField attention_text = btn_attention.GetChild("title").asTextField;
        GLoader    btn_image      = btn_attention.asCom.GetChild("n1").asLoader;

        btn_image.visible = true;
        GObject    reletion  = item.asCom.GetChild("n2");
        GTextField rankScore = item.asCom.GetChild("n21").asCom.GetChild("n2").asTextField;
        GTextField lv        = item.asCom.GetChild("n1").asCom.GetChild("n2").asTextField;

        reletion.visible      = false;
        btn_attention.visible = true;
        userModel.GetUnlcok(Config.UNLOCK_GUILD, guild);

        btn_attention.RemoveEventListeners();
        btn_attention.onClick.Add(() =>
        {
            //关注的实现
            Dictionary <string, object> dd = new Dictionary <string, object> ();
            dd ["fuid"] = dc ["uid"];
            NetHttp.inst.Send(NetBase.HTTP_FOLLOW, dd, (VoHttp vo) =>
            {
                if ((bool)vo.data == true)
                {
                    roleModel.AddAttentionFight(dc["uid"].ToString());
                    ((Dictionary <string, object>)listData[index])["if_follow"] = true;
                    Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);
                    btn_attention.touchable = false;
                }
                else
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("13120"));
                }
            });
        });
        if ((bool)dc ["if_black"])
        {        //是否拉黑
            Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textShieldd, fontSize, textBtnColor, "", 0);
            type = 1;
            btn_attention.touchable = false;
        }
        else if ((bool)dc["if_follow"])
        {
            //是否已关注
            Tools.SetButtonBgAndColor(btn_attention, btnBgDo, textAttentiond, fontSize, textBtnColor, "", 0);
            type = 2;
            btn_attention.touchable = false;
        }
        else
        {
            Tools.SetButtonBgAndColor(btn_attention, btnBgUp, textAttention, fontSize, textBtnColor, textBtnStrokeColor);
            btn_attention.touchable = true;
        }

        achieve.url = userModel.GetRankImg((int)dc["rank_score"]);
        mask_btn.RemoveEventListeners();
        mask_btn.onClick.Add(() =>
        {
            roleModel.SetTempData(listData, new int[] { index });
            string uid_ = dc ["uid"] + "";
            if (!uid_.Equals(userModel.uid))
            {
                this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { null, uid_, roleModel.tab_CurSelect1, roleModel.tab_CurSelect2, roleModel.tab_CurSelect3 }));
            }
            else
            {
                ViewManager.inst.ShowText(Tools.GetMessageById("13106"));
            }
        });
        lv.text = dc ["lv"].ToString();
        if (Tools.IsNullEmpty(dc["uname"]))
        {
            name.text = dc ["uid"] + "";
        }
        else
        {
            name.text = dc["uname"].ToString();
        }
        string dc_ = (string)dc ["head_use"];

        Tools.SetLoaderButtonUrl(photo, ModelUser.GetHeadUrl(dc_));
        if (dc["guild_name"] == null)
        {
            guild.text = Tools.GetMessageById("19955");
        }
        else
        {
            guild.text = dc["guild_name"] + "";
        }
        switch (dc["type"].ToString())
        {
        case "redbag":
            status.text = Tools.GetMessageById("19963");
            break;

        case "battle_man":
            status.text = Tools.GetMessageById("19964");
            break;

        case "elv_lv":
            status.text = Tools.GetMessageById("19965");
            break;
        }
        rankScore.text = dc ["rank_score"] + "";
    }
Example #28
0
 public void ObjectAdd(GObject a)
 {
     GObjects.Add(a);
 }
    /// <summary>
    /// 响应手牌点击事件的函数
    /// </summary>
    public void OnClickHandCard(EventContext context)
    {
        // 如果不是玩家回合,则无法使用卡牌
        if (!Gameplay.Instance().roundProcessController.IsPlayerRound())
        {
            return;
        }

//		int index = _handcardList.GetChildIndex(context.data as GObject);
//		BaseCard baseCardReference = handcardInstanceList[index].GetComponent<BaseCard>();
//		if (!Player.Instance().CanConsumeAp(baseCardReference.cost))
//		{
//			Debug.Log("Ran out of AP, cant use this one");
//			return;
//		}

        GObject item = context.data as GObject;

        // 确认当前点击的卡牌和上次点击的不同,此时表明用户想使用这张卡牌
        if (item != lastClicked)
        {
            // 改变记录
            lastClicked = item;
            // 动效
            //DoSpecialEffect(item);
            // 设置当前选中的卡牌
            CardManager.Instance().SetSelectingCard(_handcardList.GetChildIndex(item));
        }
        else         // 此时用户点击的牌和上次相同,表示用户想取消使用
        {
            // 恢复原大小
            foreach (GObject litem in _handcardList.GetChildren())
            {
                StartCoroutine(FancyHandCardEffect(litem, 1));
            }

            // 重置上次选择项
            lastClicked = null;

            // 调用取消使用方法
            CardManager.Instance().CancleUseCurrentCard();

            // 结束函数执行,因为用户取消使用
            return;
        }

        CardManager.Instance().OnUseCurrentCard();

//		// 若是效果牌
//		if (baseCardReference.type.Equals("Order"))
//		{
////			// 判断使用结果
////			if (baseCardReference.Use())
////			{
////				// 使用成功则移除手牌
////				CardManager.Instance().RemoveCardToCd(index);
////				return;
////			}
//
//			baseCardReference.Use();
//
//		}
//		else
//		{
//			if (Gameplay.Instance().gamePlayInput.IsSelectingCard == false)
//			{
//				Gameplay.Instance().gamePlayInput. OnPointerDownUnitCard(handcardInstanceList[index]);
//				BattleMap.BattleMap.Instance().IsColor = true;
//			}
//		}
    }
Example #30
0
 public virtual void OnAttachElement(GObject el)
 {
 }
Example #31
0
 public ClosureInvokedArgs(GObject.Object obj, EventArgs args)
 {
     this.obj = obj;
     this.args = args;
 }
Example #32
0
 void RenderListItem(int index, GObject obj)
 {
     BuildItem bi = (BuildItem)obj;
 }
Example #33
0
    public override void ConstructFromXML(FairyGUI.Utils.XML xml)
    {
        base.ConstructFromXML(xml);

        _obj = this.GetChild("n1");
    }
Example #34
0
 //---------------------------------------------------------------------
 public static GComponent GObjectCastToGCom(GObject obj)
 {
     return((GComponent)obj);
 }
Example #35
0
        //Remove a GObject from the (main) GObject list and destroy it.
        public static void EraseGObject(GObject gObject)
        {
            gObjects.Remove(gObject);

            if (gObject != null)
            {
                gObject.Free();
            }
        }
Example #36
0
 public void updateObjectZ(GObject obj)
 {
     obj.renderedGameObject.transform.position = new Vector3(
         obj.renderedGameObject.transform.position.x,
         obj.renderedGameObject.transform.position.y,
         GameRenderer.GRenderer.getZUnitsObject(new Vector2(obj.renderedGameObject.transform.position.x, obj.renderedGameObject.transform.position.y))
     );
 }
Example #37
0
        /// <summary>
        /// 获取组件包围盒
        /// </summary>
        /// <returns>x:最小值 y:最小值 w:宽 h:高</returns>
        public static Rect GetRect(GComponent gcom)
        {
            if (gcom == null)
            {
                return(Rect.zero);
            }

            float ax = 0f;
            float ay = 0f;
            float aw = 0f;
            float ah = 0f;

            GObject[] childs       = new GObject[4];
            GObject   maxDisschild = null;
            float     diss         = 0f;

            int cnt = gcom.numChildren;

            if (gcom.numChildren > 0)
            {
                ax = int.MaxValue;
                ay = int.MaxValue;

                float ar = int.MinValue;
                float ab = int.MinValue;

                float tmp;

                for (int i = 0; i < cnt; ++i)
                {
                    GObject child = gcom.GetChildAt(i);

                    tmp = child.xMin;

                    if (tmp < ax)
                    {
                        ax        = tmp;
                        childs[0] = child;
                    }

                    tmp = child.yMin;

                    if (tmp < ay)
                    {
                        ay        = tmp;
                        childs[1] = child;
                    }

                    tmp = child.xMin + child.actualWidth;

                    if (tmp > ar)
                    {
                        ar        = tmp;
                        childs[2] = child;
                    }

                    tmp = child.yMin + child.actualWidth;

                    if (tmp > ab)
                    {
                        ab        = tmp;
                        childs[3] = child;
                    }
                }

                for (int i = 0; i < childs.Length; ++i)
                {
                    if (diss <= childRadiusDiss(childs[i]))
                    {
                        diss         = childRadiusDiss(childs[i]);
                        maxDisschild = childs[i];
                    }
                }

                var ratio = Mathf.Max(maxDisschild.actualWidth, maxDisschild.height) / Mathf.Min(maxDisschild.actualWidth, maxDisschild.actualHeight);

                diss = diss * ratio;

                aw = ar - ax + diss;
                ah = ab - ay + diss;

                ax = ax - diss * 0.5f;
                ay = ay - diss * 0.5f;

                return(new Rect(ax, ay, aw, ah));
            }

            return(new Rect(gcom.x, gcom.y, gcom.actualWidth, gcom.actualHeight));
        }
Example #38
0
 /// <summary>
 /// 用GObject构建json对象
 /// </summary>
 /// <param name="obj"></param>
 public JSONObject(GObject obj)
 {
     this.data = obj;
 }
Example #39
0
 //---------------------------------------------------------------------
 public static bool objIsBtn(GObject obj)
 {
     return(obj is GButton);
 }
 void RenderListItem(int index, GObject obj)
 {
     GButton item = (GButton)obj;
     item.SetPivot(0.5f, 0.5f);
     item.icon = UIPackage.GetItemURL("Curve", "n" + (index + 1));
 }
    private void ListRander(int index, GObject go)
    {
        GButton btn = go.asCom.GetChild("n0").asButton;

        if (index == 0 || index % 2 == 0)
        {
            btn.alpha = 0;
        }
        else
        {
            btn.alpha = 1;
        }
        GButton    btn_btn     = go.asCom.GetChild("n13").asButton;
        GTextField l_mc        = go.asCom.GetChild("n18").asCom.GetChild("n4").asTextField;
        GLoader    img_icon    = go.asCom.GetChild("n3").asLoader;
        GTextField l_guildName = go.asCom.GetChild("n4").asTextField;
        GTextField l_guildNum  = go.asCom.GetChild("n6").asTextField;
        GButton    btn_more    = go.asCom.GetChild("n14").asButton;
        GComponent rankscore   = go.asCom.GetChild("n21").asCom;

        GLoader    pmUpdata = go.asCom.GetChild("n16").asLoader;
        GTextField pmText   = go.asCom.GetChild("n17").asTextField;
        GLoader    pmStart  = go.asCom.GetChild("n18").asCom.GetChild("n1").asLoader;

        //		GTextField no = go.asCom.GetChild ("n19").asTextField;
        if (index > lisData.Count - 1)
        {
            l_mc.visible        = false;
            img_icon.visible    = false;
            l_guildName.visible = false;
            l_guildNum.visible  = false;
            rankscore.visible   = false;
            btn_more.visible    = false;
            pmUpdata.visible    = false;
            pmText.visible      = false;
            pmStart.visible     = false;
            btn_btn.visible     = false;
            btn.touchable       = false;
            return;
        }
        else
        {
            l_mc.visible        = true;
            img_icon.visible    = true;
            l_guildName.visible = true;
            l_guildNum.visible  = true;
            rankscore.visible   = true;
            btn_more.visible    = true;
            pmUpdata.visible    = true;
            pmText.visible      = true;
            pmStart.visible     = true;
            btn_btn.visible     = true;
            btn.touchable       = true;
        }


        pmStart.url      = Tools.GetResourceUrl("Image2:n_icon_paiming4");
        l_mc.strokeColor = Tools.GetColor("426600");
        switch ((index + 1))
        {
        case 1:
            l_mc.strokeColor = Tools.GetColor("9b5c04");
            pmStart.url      = Tools.GetResourceUrl("Image2:n_icon_paiming1");
            break;

        case 2:
            l_mc.strokeColor = Tools.GetColor("4b4b4b");
            pmStart.url      = Tools.GetResourceUrl("Image2:n_icon_paiming2");
            break;

        case 3:
            l_mc.strokeColor = Tools.GetColor("853c1d");
            pmStart.url      = Tools.GetResourceUrl("Image2:n_icon_paiming3");
            break;
        }

        btn.RemoveEventListeners();
        btn_btn.RemoveEventListeners();
        btn_more.RemoveEventListeners();
        btn.visible = true;
        if (lisData[index] is bool)
        {
            btn.visible         = false;
            btn_btn.visible     = false;
            l_mc.visible        = false;
            img_icon.visible    = false;
            l_guildName.visible = false;
            l_guildNum.visible  = false;
            pmUpdata.visible    = false;
            pmText.visible      = false;
            pmStart.visible     = false;
            rankscore.visible   = false;
            btn_more.visible    = true;
            btn_more.onClick.Add(() => {
                pagindex++;
                if (c1.selectedIndex == 0)
                {
                    NetHttp.inst.Send(NetBase.HTTP_GUILD_RANK, "page=" + pagindex, GetNewPageRank);
                }
                else
                {
                    NetHttp.inst.Send(NetBase.HTTP_GUILD_LOCATION_RANK, "page=" + pagindex, GetNewPageRank);
                }
            });
            return;
        }
        else
        {
            btn.visible = true;
        }

        btn_btn.visible     = true;
        l_mc.visible        = true;
        img_icon.visible    = true;
        l_guildName.visible = true;
        l_guildNum.visible  = true;
        pmUpdata.visible    = true;
        pmText.visible      = true;
        pmStart.visible     = true;
        rankscore.visible   = true;
        btn_more.visible    = false;
        Dictionary <string, object> _da = (Dictionary <string, object>)(lisData[index]);

        btn_more.text = Tools.GetMessageById("20183");
        btn_btn.GetChild("title").asTextField.textFormat.size = 25;
        if ((bool)_da ["is_apply"])
        {
            btn_btn.text = Tools.GetMessageById("20106");
//			btn_btn.GetController ("c1").selectedIndex = 1;
            btn_btn.GetChild("title").asTextField.strokeColor = Tools.GetColor("dd8680");
            btn_btn.GetChild("n6").asLoader.url = Tools.GetResourceUrl("Image2:n_btn_15");
        }
        else
        {
            btn_btn.text = Tools.GetMessageById("20105");
//			btn_btn.GetController ("c1").selectedIndex = 0;
            btn_btn.GetChild("title").asTextField.strokeColor = Tools.GetColor("52b04f");
            btn_btn.GetChild("n6").asLoader.url = Tools.GetResourceUrl("Image2:n_btn_14");
        }

        l_mc.text = Tools.StartValueTxt((index + 1));         //(index + 1).ToString ();

        img_icon.url = Tools.GetResourceUrl("Icon:" + (string)(_da ["icon"]));
//		Tools.SetLoaderButtonUrl(img_icon, ModelUser.GetHeadUrl ((string)(_da ["icon"])));
        l_guildName.text = (string)(_da ["name"]);
        l_guildNum.text  = Tools.GetMessageById("20103", new string[] { (_da ["member_count"]).ToString() + "/" + ((int)(ModelManager.inst.guildModel.getGuildCfg("society") ["society_num"])).ToString() });          //+ "[color=#ff9900]" + (_da ["member_count"]).ToString () + "/" + ((int)(ModelManager.inst.guildModel.getGuildCfg ("society") ["society_num"])).ToString () + "[/color]";
        rankscore.GetChild("n2").asTextField.text = (_da ["score"]).ToString();
        if ((int)(_da ["rank_diff"]) == 0)
        {
            pmUpdata.url = Tools.GetResourceUrl("Image:icon_bubian");
            pmText.text  = "";
        }
        else
        {
            string color = "";
            if ((int)(_da ["rank_diff"]) > 0)
            {
                color        = "54b116";
                pmUpdata.url = Tools.GetResourceUrl("Image:icon_up");
            }
            else
            {
                color        = "d33623";
                pmUpdata.url = Tools.GetResourceUrl("Image:icon_down");
            }
            pmText.text = Tools.GetMessageColor("[0]" + Math.Abs((int)(_da ["rank_diff"])).ToString() + "[/0]", new string[] { color });
        }
        //btn.RemoveEventListeners();
        btn.onClick.Add(() => {
            NetHttp.inst.Send(NetBase.HTTP_GUILD_INFO, "gid=" + (_da ["id"]).ToString(), GetGuildInfo);
        });

        btn_btn.onClick.Add(() => {
            if ((bool)_da ["is_apply"])
            {
                NetHttp.inst.Send(NetBase.HTTP_GUILD_CANCEL_MEMBER, "gid=" + (_da ["id"]).ToString(), OnGuildQuxiao, '|', errorHttp);
            }
            else
            {
                if ((_da ["member_count"]).ToString() == ((int)(ModelManager.inst.guildModel.getGuildCfg("society")["society_num"])).ToString())
                {
                    ViewManager.inst.ShowText(Tools.GetMessageById("20169"));
                    return;
                }
                Dictionary <string, object> daAtt = (Dictionary <string, object>)_da["attrs"];
                if (daAtt.ContainsKey("join_condition"))
                {
                    Dictionary <string, object> daAtt2 = (Dictionary <string, object>)daAtt["join_condition"];
                    if (daAtt2.ContainsKey("type") && ((int)daAtt2["type"] == 2 || (int)daAtt2["type"] == 1))
                    {
                        if (userModel.lv < (int)daAtt2["lv"])
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("20185"));
                            return;
                        }
                        else if (userModel.effort_lv < (int)daAtt2["effort_lv"])
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("20184"));
                            return;
                        }
                        else if (userModel.rank_score < (int)daAtt2["rank_score"])
                        {
                            ViewManager.inst.ShowText(Tools.GetMessageById("20186"));
                            return;
                        }
                    }
                }
                NetHttp.inst.Send(NetBase.HTTP_GUILD_APPLY_MEMBER, "gid=" + (_da ["id"]).ToString(), OnGuildShenqing, '|', errorHttp);
            }
            curobj   = lisData[index];
            curIndex = index;
            curbtn   = btn_btn;
        });
    }
Example #42
0
 public void Init(GObject.GType gtype)
 {
     g_value_init (ref this, gtype.Val);
 }
Example #43
0
 /// <summary>
 /// The rendertexture is not transparent. So if you want to the UI elements can be seen in the back of the models/particles in rendertexture,
 /// you can set a maximunm two images for background.
 /// Be careful if your image is 9 grid scaling, you must make sure the place holder is inside the middle box(dont cover from border to middle).
 /// </summary>
 /// <param name="image"></param>
 public void SetBackground(GObject image)
 {
     SetBackground(image, null);
 }
Example #44
0
 /// <summary>
 /// The rendertexture is not transparent. So if you want to the UI elements can be seen in the back of the models/particles in rendertexture,
 /// you can set a maximunm two images for background.
 /// Be careful if your image is 9 grid scaling, you must make sure the place holder is inside the middle box(dont cover from border to middle).
 /// </summary>
 /// <param name="image"></param>
 public void SetBackground(GObject image)
 {
     SetBackground(image, null);
 }
Example #45
0
 //---------------------------------------------------------------------
 public static bool objIsComponent(GObject obj)
 {
     return(obj is GComponent);
 }
Example #46
0
    void Start()
    {
        Application.targetFrameRate = 60;
        Stage.inst.onKeyDown.Add(OnKeyDown);

        _mainView = this.GetComponent<UIPanel>().ui;

        _backBtn = _mainView.GetChild("btn_Back");
        _backBtn.visible = false;
        _backBtn.onClick.Add(onClickBack);

        _demoContainer = _mainView.GetChild("container").asCom;
        _viewController = _mainView.GetController("c1");

        _demoObjects = new Dictionary<string, GComponent>();

        int cnt = _mainView.numChildren;
        for (int i = 0; i < cnt; i++)
        {
            GObject obj = _mainView.GetChildAt(i);
            if (obj.group != null && obj.group.name == "btns")
                obj.onClick.Add(runDemo);
        }
    }
Example #47
0
    private void GetNearData(int type, GObject more)
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data["lon"]      = lon;
        data["lat"]      = lat;
        data["page_num"] = tag_n;
        // Debug.Log("tag_n_" + tag_n);
        NetHttp.inst.Send(NetBase.HTTP_GETNEAR, data, (VoHttp vo) =>
        {
            Dictionary <string, object> temp = new Dictionary <string, object>();
            temp["uid"]    = -1;
            temp["type"]   = 0;
            object[] data1 = (object[])vo.data;
            if (data1.Length > 0)
            {
                if (type == 2)
                {
                    foreach (object d in data1)
                    {
                        listData.Add(d);
                    }
                    if (data1.Length >= num)
                    {
                        listData.Add(temp);
                    }
                    //list.numItems = listData.Count;
                    SetListCSS(list, listData.ToArray(), 6, true);
                    list.ScrollToView(0);
                }
                else
                {
                    listData.RemoveAt(listData.Count - 1);
                    foreach (object d in data1)
                    {
                        listData.Add(d);
                    }
                    if (data1.Length >= num)
                    {
                        listData.Add(temp);
                    }
                    Debug.Log("listData.Count" + listData.Count);
                    Debug.Log("dataPreNum" + dataPreNum);
                    //list.numItems = listData.Count;
                    SetListCSS(list, listData.ToArray(), 6, true);
                    list.ScrollToView(dataPreNum - 1);
                }
                dataPreNum = listData.Count;
            }
            else
            {
                if (tag_n == 1)
                {
                    list.numItems = 0;
                }
                else
                {
                    listData.RemoveAt(listData.Count - 1);
                    //list.numItems = listData.Count;
                    SetListCSS(list, listData.ToArray(), 6, true);
                    list.ScrollToView(listData.Count - 1);
                    ViewManager.inst.ShowText(Tools.GetMessageById("19924"));
                }
            }
            tag_n += 1;
        });
    }