コード例 #1
0
ファイル: SFMovieEx.cs プロジェクト: zwong91/Titan
 private void SetMovieRootDisplayInfoOnCreate()
 {
     if (MyRootDI == null && Value.IsValueValid(MyRoot))
     {
         this.MyRootDI = MyRoot.GetDisplayInfo();
     }
 }
コード例 #2
0
ファイル: GFxGameHud.cs プロジェクト: zwong91/Titan
    //#region 指示器
    ///// <summary>
    ///// 指示器对象显示半径
    ///// </summary>
    //public float BillboardRadius = 600;
    ///// <summary>
    ///// 指示器对象在这个角度内以直线方式绘制
    ///// </summary>
    //public int BillboardAngle = 30;
    ///// <summary>
    ///// 指示器坐标缓存
    ///// </summary>
    //protected UIBillboardCache BillboardCache = new UIBillboardCache();
    ///// <summary>
    ///// 临时实体数据
    ///// </summary>
    //private List<UIBillboardQueryResult> tmpAroundEntitys = new List<UIBillboardQueryResult>();
    ///// <summary>
    ///// 范围内活动的实体
    ///// </summary>
    //protected Dictionary<Int32, EntityView> RangeActivityEntity = new Dictionary<int, EntityView>();

    ///// <summary>
    ///// 需要隐藏的实体
    ///// </summary>
    //List<int> HideHeroList = new List<int>();

    ////保存附近玩家
    //public void saveAroundPlayer()
    //{
    //    EntityView ev = EntityFactory.getMainPlayer();
    //    if (ev == null)
    //    {
    //        return;
    //    }
    //    List<Int32> TmpEntityIDList = new List<int>(RangeActivityEntity.Keys);

    //    IList<EntityView> AroundEntitiesList = MapFinderManager.Nearest(ev.StateMachine.transform.position, ev.Sight, SPELL.CampFlag.CampFlag_Enemy);
    //    if (AroundEntitiesList == null)
    //    {
    //        return;
    //    }
    //    Int32 nTmpEntityID = 0;
    //    foreach (EntityView Entity_Ev in AroundEntitiesList)
    //    {
    //        nTmpEntityID = Entity_Ev.ID;
    //        if (Entity_Ev == null || Entity_Ev.StateMachine == null || Entity_Ev.StateMachine.GetState() == EntityState.Dead || Entity_Ev.Type != ENTITY_TYPE.TYPE_PLAYER_ROLE)
    //            continue;
    //        if (!RangeActivityEntity.ContainsKey(nTmpEntityID))
    //        {
    //            RangeActivityEntity.Add(nTmpEntityID, Entity_Ev);
    //        }
    //        else
    //        {
    //            TmpEntityIDList.Remove(nTmpEntityID);
    //        }
    //    }

    //    while (TmpEntityIDList.Count > 0)
    //    {
    //        nTmpEntityID = TmpEntityIDList[0];
    //        RangeActivityEntity.Remove(nTmpEntityID);
    //        TmpEntityIDList.RemoveAt(0);
    //    }
    //}

    ////更新指示器公告板信息
    //private void UpdateBillboard(System.Collections.Generic.List<UIBillboardQueryResult> entitys)
    //{
    //    BillboardCache.BeginProcessing();
    //    SFDisplayInfo info;
    //    UIBillboardMC tmpBillboard;
    //    for (int i = 0; i < entitys.Count; i++)
    //    {
    //        //从缓冲列表里获取可用的对象
    //        if (BillboardCache.GetUnusedBillboardMovieclip(entitys[i].entityID, out tmpBillboard))
    //        {
    //            info = tmpBillboard.Billboard.GetDisplayInfo();
    //            info.Visible = true;
    //            info.X = entitys[i].x;
    //            info.Y = entitys[i].y;
    //            tmpBillboard.Billboard.SetDisplayInfo(info);

    //            EntityView targetEntityView = EntityFactory.getEntityViewByID(entitys[i].entityID);
    //            int nEntityHeroID = targetEntityView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION);
    //            int nTargetCamp = (int)targetEntityView.CampFlag;
    //            //public function SetHeroBearing(_nTargetHeroPortraitID:int,_nTargetCamp:int,_strTargetDistance:String)

    //            if (tmpBillboard.Billboard.Invoke("SetHeroBearing", nEntityHeroID, nTargetCamp, entitys[i].angle,entitys[i].distance+"米") == null)
    //            {
    //                Trace.LogError("call SetHeroBearing failed.");
    //            }
    //        }
    //    }
    //    BillboardCache.EndProcessing();
    //}

    //private void GetPlayerAndUpdate()
    //{
    //    //移除上次调用存储的数据
    //    tmpAroundEntitys.Clear();
    //    if (RangeActivityEntity.Count > 0 && EntityFactory.MainHeroView.StateMachine.GetState() != EntityState.Dead)
    //    {
    //        foreach (KeyValuePair<int, EntityView> keypair in RangeActivityEntity)
    //        {
    //            GetQueryTarget(keypair.Key, keypair.Value.gameObject.transform);
    //        }
    //    }
    //    UpdateBillboard(tmpAroundEntitys);
    //}

    ////计算英雄与附近的玩家目标的角度并映射到UI上
    //private void GetQueryTarget(Int32 entityID, Transform TargetEntityTrans)
    //{
    //    Transform CameraTransform = SoldierCamera.MainInstance.getCameraTransform();
    //    //计算位置应该是计算英雄的位置,而不是相机的位置
    //    float checkDis = Vector3.Distance(TargetEntityTrans.position, EntityFactory.MainHero.transform.position);

    //    if (checkDis > EntityFactory.MainHeroView.Sight || ScreenRaycast.isInScreen(TargetEntityTrans.position))
    //        return;

    //    Vector3 vecHeroPos = EntityFactory.MainHeroView.gameObject.transform.position;
    //    Vector3 DirHeroToTarget = TargetEntityTrans.position - vecHeroPos;
    //    Vector3 DirHeroToCamera = CameraTransform.position - vecHeroPos;
    //    DirHeroToTarget.y = DirHeroToCamera.y = 0;


    //    //判断目标在相机的左右方,-1左方,+1右方
    //    Vector3 vecCross = Vector3.Cross(DirHeroToTarget.normalized, DirHeroToCamera.normalized);
    //    float fLorR = Mathf.Sign(-vecCross.y);

    //    //计算之间的夹角
    //    float angle = Vector3.Angle(DirHeroToTarget.normalized, DirHeroToCamera.normalized);
    //    float relAngle = (angle * fLorR + 90) % 360;


    //    float MovieWidth = MovieDef.GetWidth();
    //    float MovieHeight = MovieDef.GetHeight();

    //    UIBillboardQueryResult qr = new UIBillboardQueryResult();
    //    qr.entityID = entityID;
    //    qr.x = (MovieWidth / 2) + BillboardRadius * (Mathf.Cos(Mathf.Deg2Rad * (relAngle)));
    //    qr.y = (MovieHeight / 2) + BillboardRadius * (Mathf.Sin(Mathf.Deg2Rad * (relAngle)));

    //    //在这个角度范围内图标水平移动
    //    if (relAngle > BillboardAngle && relAngle < BillboardAngle + 120)
    //    {
    //        qr.y = (MovieHeight / 2) + BillboardRadius * (Mathf.Sin(Mathf.Deg2Rad * BillboardAngle));
    //    }

    //    qr.distance = Convert.ToUInt32(checkDis);
    //    qr.angle = Convert.ToInt32(relAngle+90);
    //    tmpAroundEntitys.Add(qr);

    //}

    //public void ClearBillboardCache()
    //{
    //    if (BillboardCache != null)
    //    {
    //        BillboardCache.ClearCache();
    //        BillboardCache = null;
    //    }

    //    if (RangeActivityEntity == null)
    //    {
    //        RangeActivityEntity.Clear();
    //        RangeActivityEntity = null;
    //    }

    //    if (tmpAroundEntitys != null)
    //    {
    //        tmpAroundEntitys.Clear();
    //        tmpAroundEntitys = null;
    //    }

    //    if (HideHeroList != null)
    //    {
    //        HideHeroList.Clear();
    //        HideHeroList = null;
    //    }
    //}


    //public void OnTimer(int nTimerID)
    //{
    //    switch( nTimerID )
    //    {
    //        case (int)EN_GameHud_Timer.ENGT_Pointer:
    //            {

    //                saveAroundPlayer();

    //                int nCount = HideHeroList.Count;
    //                for (int i = 0; i < nCount; ++i  )
    //                {
    //                    if (RangeActivityEntity.ContainsKey(HideHeroList[i]))
    //                    {
    //                        RangeActivityEntity.Remove(HideHeroList[i]);
    //                    }
    //                }
    //            }
    //            break;
    //        default:
    //            break;
    //    }
    //}



    //public void OnEvent(U3D_Render.Utility.EVENT eventID, int sourceID, System.Object objEvent)
    //{
    //    switch( eventID )
    //    {
    //        case EVENT.ENTITY_SHOW_HERO:
    //            {
    //                if ( objEvent == null )
    //                    return;
    //                SEntityShowHero event_data = (SEntityShowHero)objEvent;
    //                int nId = event_data.ev.ID;
    //                if (event_data.bIsHide && !HideHeroList.Contains(nId))
    //                    HideHeroList.Add(nId);
    //                else if (!event_data.bIsHide && HideHeroList.Contains(nId))
    //                    HideHeroList.Remove(nId);
    //            }
    //            break;
    //        default:
    //            break;
    //    }
    //}

    //#endregion
    #region 技能提示
    public void CreatureShowPormptUI(cmd_creature_ShowPromptUI data)
    {
        if (vSpellPrompt == null)
        {
            vSpellPrompt = new Value();
            MyRoot.AttachMovie(ref vSpellPrompt, "Com.Scaleform.WarGameHud.WGH_SpellPrompt", "vSpellPrompt", 0);
            SFDisplayInfo di = vSpellPrompt.GetDisplayInfo();
            di.X = 1920 / 2 + 100;
            di.Y = 1080 - 300;
            vSpellPrompt.SetDisplayInfo(di);
        }

        IntPtr DesPtr, IconPtr; //R

        ASpeedGame.Data.GameMobaSchemes.SSchemeShowSpellPrompt SchemesSpellPrompt = ASpeedGame.Data.GameMobaSchemes.GameMobaSchemesManager.Instance.GetSpellPromptInfo(data.nPromptID);


        if (SchemesSpellPrompt != null)
        {
            DesPtr  = GameLogicAPI.getShortcutDes(SchemesSpellPrompt.nSlotID, (int)SLOT_TYPE.SLOT_TYPE_SKILL);
            IconPtr = GameLogicAPI.getSpellData(SchemesSpellPrompt.nSpellID);

            if (DesPtr != IntPtr.Zero && IconPtr != IntPtr.Zero)
            {
                string           des       = IntPtrHelper.Ptr2Str(DesPtr);
                SPELL.SPELL_DATA spellData = IntPtrHelper.toData <SPELL.SPELL_DATA>(IconPtr);

                if (vSpellPrompt == null || vSpellPrompt.Invoke("SetSpellPromptInfo", spellData.nIcon, des.ToUpper(), Convert.ToBoolean(data.nType)) == null)
                {
                    Trace.LogWarning("SetSpellPromptInfo failed.");
                }
            }
        }
    }
コード例 #3
0
ファイル: GFxTeamRightHud2AS.cs プロジェクト: zwong91/Titan
    // 設置敵對英雄頭像及cd時間
    public void SetRivalryHeroInfo(int uId, int nHeroIconID, int nReliveTime)
    {
        if (!Value.IsValueValid(empytPointMC))
        {
            return;
        }
        this.nRivalryNum++;
        Value NewHPS = new Value();

        if (!empytPointMC.AttachMovie(ref NewHPS, this.heroPortraitClass, this.heroPortraitInsName + this.nRivalryNum, 1))
        {
            Trace.LogError("error attach RightHeroPortraitSlot Value failed");
            return;
        }
        if (!Value.IsValueValid(NewHPS))
        {
            return;
        }
        SFDisplayInfo NewHPSDI = NewHPS.GetDisplayInfo();

        NewHPSDI.Y = (70) * this.nRivalryNum;
        NewHPSDI.X = 130;
        NewHPS.SetDisplayInfo(NewHPSDI);
        rivalryGfxTable[uId] = NewHPS;

        if (NewHPS.Invoke("SetHeroIcon", nHeroIconID, uId) == null || NewHPS.Invoke("SetHeroReliveTime", nReliveTime, true) == null)
        {
            Trace.LogError("error SetRivalryHeroInfo call SetHeroIcon or SetHeroReliveTime failed!");
            return;
        }
    }
コード例 #4
0
            public SFDisplayInfo GetDisplayInfo()
            {
                SFDisplayInfo dinfo  = new SFDisplayInfo();
                Int32         size   = Marshal.SizeOf(typeof(SFDisplayInfo));
                bool          retVal = SF_GetDisplayInfo(this, dinfo, size);

                return(retVal ? dinfo : null);
            }
コード例 #5
0
            public bool SetDisplayInfo(SFDisplayInfo dinfo)
            {
                if (!IsDisplayObject())
                {
                    return(false);
                }
                Int32 size = Marshal.SizeOf(typeof(SFDisplayInfo));

                return(SF_SetDisplayInfo(this, dinfo, size));
            }
コード例 #6
0
ファイル: UIComponent.cs プロジェクト: zwong91/Titan
 public UIComponent(Value Ins)
 {
     m_bEnable        = true;
     m_bVisible       = true;
     m_isOnCameraView = true;
     FinalVisible     = true;
     m_Scale          = Vector2.one;
     m_PixPos         = Vector2.zero;
     m_Roation        = 0.0f;
     m_Instance       = Ins;
     m_DisplayInfo    = m_Instance.GetDisplayInfo();
 }
コード例 #7
0
ファイル: GFxTeamRightHud2AS.cs プロジェクト: zwong91/Titan
 // 遍历敌人死亡列表,改变位置即可
 public void ShowRivalryDieList()
 {
     foreach (int key in rivalryGfxTable.Keys)
     {
         this.nRivalryNum++;
         Value NewHPS = rivalryGfxTable[key] as Value;
         if (!Value.IsValueValid(NewHPS))
         {
             return;
         }
         SFDisplayInfo NewHPSDI = NewHPS.GetDisplayInfo();
         NewHPSDI.Y = (70) * this.nRivalryNum;
         NewHPS.SetDisplayInfo(NewHPSDI);
     }
 }
コード例 #8
0
ファイル: GFxGameHud.cs プロジェクト: zwong91/Titan
    void CalCrossHairPos()
    {
        if (!this.IsRegisterMovieSuccess)
        {
            return;
        }

        SFDisplayInfo di = CrossHairMC.GetDisplayInfo();
        double        _x = di.X;
        double        _y = di.Y;
        Vector3       CrossHairStagePos = new Vector3((float)_x, (float)_y);

        _vCrossHairPos = this.StagePointToScreenPoint(CrossHairStagePos);
        //#if UNITY_EDITOR
        //        _vCrossHairPos.y -= 14;
        //#endif
    }
コード例 #9
0
ファイル: GFxTeamRightHud2AS.cs プロジェクト: zwong91/Titan
    //右侧信息栏,同阵营玩家信息槽
    public void SetPlayerHeroSlotInfo(IntPtr ptrParam, int nPtrLen)
    {
        if (!Value.IsValueValid(empytPointMC))
        {
            return;
        }
        IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptrParam, nPtrLen);
        cmd_count nCountdata          = helper.get <cmd_count>();

        for (int i = 1; i <= nCountdata.nCount; ++i)
        {
            cmd_entity_camp_palyer_uidinfo data = helper.get <cmd_entity_camp_palyer_uidinfo>();
            Value NewHPS = new Value();
            //连接as接口
            if (!empytPointMC.AttachMovie(ref NewHPS, this.rightHeroPortraitClass, this.rightheroPortraitInsName + i, 1))
            {
                Trace.LogError("attach RightHeroPortraitSlot Value failed");
                return;
            }
            if (!Value.IsValueValid(NewHPS))
            {
                return;
            }

            //建立相应位置
            SFDisplayInfo NewHPSDI = NewHPS.GetDisplayInfo();
            NewHPSDI.Y = (70) * i;
            NewHPSDI.X = 205;
            NewHPS.SetDisplayInfo(NewHPSDI);
            //将头像信息存入哈希表
            entityHPSContainer[(int)data.uPBUID] = NewHPS;
            ////初始化头像,设置头像
            //Value CurHPS = entityHPSContainer[(int)data.uPBUID] as Value;

            if (NewHPS.Invoke("SetHeroIcon", data.nHeroID) == null)
            {
                Trace.LogError("error call SetHeroIcon failed!");
                return;
            }
            NewHPS.SetMember("uPBUID", data.uPBUID);
        }
    }
コード例 #10
0
    public void SetCrosshairPos(float x, float y)
    {
        Value targetMovie = theMovie.GetMember("CrosshairMC");

        if (targetMovie != null)
        {
            SFDisplayInfo dInfo = targetMovie.GetDisplayInfo();

            if (dInfo == null)
            {
                return;
            }
            dInfo.X += x;
            dInfo.Y += y;
            targetMovie.SetDisplayInfo(dInfo);
        }

        Value textMC = theMovie.GetMember("InfoText");

        if (textMC != null)
        {
            textMC.SetText("x: " + x + "\ny: " + y);
        }
    }
コード例 #11
0
 public bool SetDisplayInfo(SFDisplayInfo dinfo)
 {
     if (!IsDisplayObject())
     {
     return false;
     }
     Int32 size = Marshal.SizeOf(typeof(SFDisplayInfo));
     return SF_SetDisplayInfo(this, dinfo, size);
 }
コード例 #12
0
 public SFDisplayInfo GetDisplayInfo()
 {
     SFDisplayInfo dinfo = new SFDisplayInfo();
     Int32 size          = Marshal.SizeOf(typeof(SFDisplayInfo));
     bool retVal         = SF_GetDisplayInfo(this, dinfo, size);
     return retVal ? dinfo : null;
 }
コード例 #13
0
 protected static extern bool SF_SetDisplayInfo(Value target, SFDisplayInfo dinfo, Int32 size);
コード例 #14
0
 private static extern bool SF_SetDisplayInfo(Value target, SFDisplayInfo dinfo, Int32 size);
コード例 #15
0
ファイル: SFValue.cs プロジェクト: NGonGames/GlobalGamJam2014
 /// <summary>
 /// Returns the DisplayInfo structure associated with a display object. The target value must be a display object. See doc for DisplayInfo for more information.
 /// </summary>
 /// <returns> DisplayInfo structure</returns>
 public SFDisplayInfo GetDisplayInfo()
 {
     SFDisplayInfo dinfo = new SFDisplayInfo();
     Int32 size          = Marshal.SizeOf(typeof(SFDisplayInfo));
     #if UNITY_WP8
     bool retVal         = sf_getDisplayInfo(this, dinfo, size);
     #else
     bool retVal         = SF_GetDisplayInfo(this, dinfo, size);
     #endif
     return retVal ? dinfo : null;
 }
コード例 #16
0
ファイル: SFValue.cs プロジェクト: NGonGames/GlobalGamJam2014
 /// <summary>
 /// Set the DisplayInfo property of the target DisplayObject to the DisplayInfo provided. Target Value must be a DisplayObject.
 /// </summary>
 /// <param name="dinfo"></param>
 /// <returns>True if the operation succeeded</returns>
 public bool SetDisplayInfo(SFDisplayInfo dinfo)
 {
     if (!IsDisplayObject())
     {
     return false;
     }
     Int32 size = Marshal.SizeOf(typeof(SFDisplayInfo));
     #if UNITY_WP8
     return sf_setDisplayInfo(this, dinfo, size);
     #else
     return SF_SetDisplayInfo(this, dinfo, size);
     #endif
 }