Esempio n. 1
0
    private bool ParseWarBuffTooltip(Value _tooltipElememts)
    {
        double _x, _y = 0;
        string _strBuffName, _strBuffDes;


        _x = (double)_tooltipElememts.GetElement(0);
        _y = (double)_tooltipElememts.GetElement(1);
        //Trace.LogWarning("_tooltipElememts.GetArraySize()=" + _tooltipElememts.GetArraySize());
        if (_tooltipElememts.GetElement(5) == null)
        {
            return(false);
        }

        _strBuffName = (string)_tooltipElememts.GetElement(5);
        _strBuffDes  = (string)_tooltipElememts.GetElement(6);

        //获得各个属性加成系数
        UBBPropertyInstance.getRatio(_strBuffDes);

        //解析UBB
        UBB.toHtml(ref _strBuffDes);
        UBB.toHtml(ref _strBuffName);



        //传数据到AS
        if (!Value.IsValueValid(WarBuffTooltip))
        {
            Trace.LogError("解析Tooltip类型时,发现WarBuffTooltip无实例对象");
            return(false);
        }
        //      public function SetText(_strBuffName:String,_strBuffDes:String)
        if (WarBuffTooltip.Invoke("SetText", _strBuffName, _strBuffDes) == null)
        {
            Trace.LogError("解析Tooltip类型时,执行 WarBuffTooltip 的SetText操作失败");
            return(false);
        }

        double tipsHeight = (double)WarBuffTooltip.GetMember("height");
        double tipsWidth  = (double)WarBuffTooltip.GetMember("width");

        GFxWarBottomCenterHud bottomCenterHud = SFGFxMovieManager.GetWindow <GFxWarBottomCenterHud>();

        if (SFGFxMovieManager.CheckTheMovieCanUse(bottomCenterHud))
        {
            double MovieDefWidth = (double)MyRoot.GetMember("VisibleRectWidth");
            _x = MovieDefWidth / 2 - tipsWidth;
            _y = bottomCenterHud.GetBottomHudYPos - (float)tipsHeight;
        }
        else
        {
            Vector3 ScreenPos = Vector3.zero;
            Vector3 StagePos  = Vector3.zero;

            ScreenPos.x = Screen.width / 4;
            ScreenPos.y = Screen.height * 2 / 5;
            StagePos    = this.ScreenPointToStagePoint(ScreenPos);
            _x          = StagePos.x;
            _y          = StagePos.y;
        }


        //让AS显示
        ShowTooltipEx(WarBuffTooltip, _x, _y);

        return(true);
    }
Esempio n. 2
0
    private bool ParseWarSkillTooltip(Value _tooltipElememts)
    {
        bool res = true;

        double _x, _y = 0;
        string _skillDes1;

        /*目前解析为测试用
         *  元素0:目标的x坐标
         *  元素1:目标的y坐标
         *  元素2:目标的宽(这里不需要)
         *  元素3:目标的高(这里不需要)
         *  元素4:目标DefaultText内容(这里不需要)
         *
         *  元素5:目标技能第一项描述
         *  元素6:目标技能ID
         */
        if (_tooltipElememts.GetArraySize() > 0)
        {
            _x = (double)_tooltipElememts.GetElement(0);
            _y = (double)_tooltipElememts.GetElement(1);
            //Trace.LogWarning("_tooltipElememts.GetArraySize()=" + _tooltipElememts.GetArraySize());
            if (_tooltipElememts.GetElement(5) == null)
            {
                return(false);
            }

            _skillDes1 = ((string)_tooltipElememts.GetElement(5)).TrimStart('$');

            //获得各个属性加成系数
            UBBPropertyInstance.getRatio(_skillDes1);

            //解析UBB
            UBB.toHtml(ref _skillDes1);

            //传数据到AS
            if (!Value.IsValueValid(WarSkillTooltip))
            {
                Trace.LogError("解析Tooltip类型时,发现WarSkillTooltip无实例对象");
                return(false);
            }
            // function SetText(_strDes1:String):void
            if (WarSkillTooltip.Invoke("SetText", _skillDes1) == null)
            {
                Trace.LogError("解析Tooltip类型时,执行WarSkillTooltip 的SetText操作失败");
                return(false);
            }

            double tipsHeight = (double)WarSkillTooltip.GetMember("height");
            double tipsWidth  = (double)WarSkillTooltip.GetMember("width");

            GFxWarBottomCenterHud bottomCenterHud = SFGFxMovieManager.GetWindow <GFxWarBottomCenterHud>();

            if (SFGFxMovieManager.CheckTheMovieCanUse(bottomCenterHud))
            {
                double VisibleRectWidth = (double)MyRoot.GetMember("VisibleRectWidth");
                double VisibleRectX     = (double)MyRoot.GetMember("VisibleRectX");
                _x = VisibleRectWidth / 2 - (float)tipsWidth / 2;
                _y = bottomCenterHud.GetBottomHudYPos - (float)tipsHeight;
            }
            else
            {
                Vector3 ScreenPos = Vector3.zero;
                Vector3 StagePos  = Vector3.zero;

                ScreenPos.x = Screen.width / 4;
                ScreenPos.y = Screen.height * 2 / 5;
                StagePos    = this.ScreenPointToStagePoint(ScreenPos);
                _x          = StagePos.x;
                _y          = StagePos.y;
            }


            //让AS显示
            ShowTooltipEx(WarSkillTooltip, _x, _y);
        }

        return(res);
    }