Пример #1
0
    //初始化
    public void Init()
    {
        if (unitinfo == null)
        {
            return;
        }
        //关闭按钮
        unitinfo.GetChild("close").asButton.onClick.Add(() => { Destroy(); });

        var item = ExcelManager.Instance.GetSceneManager().GetSceneByID(GameScene.Singleton.m_SceneID);

        if (item != null)
        {
            var scenename   = item.Name;
            var postext     = "(" + (int)unit.X + "," + (int)unit.Y + ")";
            var noticewords = ExcelManager.Instance.GetNoticeWordsManager().GetNoticeWordsByID(38);
            Dictionary <string, string> p = new Dictionary <string, string>();
            p["p1"] = item.Name;
            p["p2"] = ("" + (int)unit.X);
            p["p3"] = ("" + (int)unit.Y);
            p["p4"] = (unit.Name);
            if (noticewords != null)
            {
                //定位信息
                unitinfo.GetChild("localpos").asButton.onClick.Add(() => {
                    ChatUI.SOpenChatBoxWithMsg("quanfu", "", 0, Tool.ParseTemplate(noticewords.Words, p));
                });
            }
        }



        InitItemDrag();
        InitDropItem();
        InitSkillInfo();


        //模型
        var modeeffect = (GameObject)(GameObject.Instantiate(Resources.Load(unit.ModeType)));

        modeeffect.transform.localPosition = new Vector3(0, 0, 100);
        var box = modeeffect.GetComponent <BoxCollider>();

        modeeffect.transform.localScale = new Vector3(100, 100, 100);
        if (box != null)
        {
            var scale = box.size.y / 1.2f;
            modeeffect.transform.localScale = new Vector3(100 / scale, 100 / scale, 100 / scale);
        }


        Vector3 rotation = modeeffect.transform.localEulerAngles;

        rotation.x = 10; // 在这里修改坐标轴的值
        rotation.y = 180;
        rotation.z = 0;
        //将旋转的角度赋值给预制出来需要打出去的麻将
        modeeffect.transform.localEulerAngles = rotation;
        GGraph    holder  = unitinfo.GetChild("heromode").asGraph;
        GoWrapper wrapper = new GoWrapper(modeeffect);

        holder.SetNativeObject(wrapper);
        holder.z = 10;
    }