Exemplo n.º 1
0
        public bool RemoveMovie(Movie movie)
        {
            if (graphs.ContainsKey(movie.Category))
            {
                var graph     = graphs[movie.Category];
                var movieNode = new MovieNode
                {
                    Name = movie.Name,
                    Tags = movie.Tags
                };

                var neighbours = graph.Neighbours(movieNode);
                if (neighbours.Count > 0)
                {
                    foreach (var neighbour in neighbours)
                    {
                        graph.RemoveEdge(movieNode, neighbour);
                    }
                    var removed = graph.RemoveVertex(movieNode);
                    return(removed);
                }
                else
                {
                    var removed = graph.RemoveVertex(movieNode);
                    return(removed);
                }
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
    /// <summary>
    /// 取得头顶名字
    /// </summary>
    /// <param name="moveNode"></param>
    /// <returns></returns>
    static TopName GetTopName(ref MovieNode moveNode)
    {
        TopName tp = null;

        if (!OptimitzedControlPlane.Instance.EnityCreateOptimize)
        {
            tp       = CreateTopNameInstance();
            moveNode = new MovieNode();
            return(tp);
        }

        if (m_CacheTopName.Count > 0)
        {
            tp = m_CacheTopName.Dequeue();
            tp.SetEnable(true);
            moveNode = tp.movieNode;
        }
        else
        {
            if (!AllocTopNamePos(ref moveNode))
            {
                //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个头顶名!!");
                return(null);
            }
            tp = CreateTopNameInstance();
        }
        return(tp);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 创建一个头顶名称
    /// </summary>
    /// <param name="entry">实体</param>
    /// <param name="entryId">实体ID</param>
    /// <param name="text">内容</param>
    /// <param name="col">颜色</param>
    /// <returns></returns>
    public static TopName CreateTopName(GameObject entry, int entryId, string text, Color col)
    {
        if (SFGFxMovieManager.Instance == null)
        {
            Trace.LogError("SFGFxMovieManager没有初始化,请不要在Awake或Start中创建!");
            return(null);
        }

        if (!bInit)
        {
            Trace.LogError("GfxLableManager必须初始化!");
            return(null);
        }
        //有可能TopNameMovie还没有创建完成.
        if (TopNameMovie.Instance == null)
        {
            //Trace.LogError("TopNameMovie尚未创建完成,请等待创建完成后再调用。");
            return(null);
        }
        if (m_TopNameMap.ContainsKey(entryId))
        {
            Trace.LogWarning(entryId + "已经有头顶名,返回已有的实例");

            return(m_TopNameMap[entryId]);
        }

        U3D_Render.EntityView objev = EntityFactory.getEntityViewByID(entryId);
        if (!objev.IsValid)
        {
            Trace.LogWarning("实体视图无效!id=" + entryId);
            return(null);
        }
        ENTITY_TYPE entityType = objev.Type;

        MovieNode trs = new MovieNode();


        TopName t = GetTopName(ref trs);

        if (t == null)
        {
            return(t);
        }
        t.Init(entry, entryId, text, col);
        t.CreateBillBorad();
        t.ChangeMovieNode(trs);
        m_TopNameMap.Add(entryId, t);
        index++;
        ChangeMask(EntityFactory.getEntityViewByID(entryId), true);

        //if (!go)
        //{
        //    go = GameObject.CreatePrimitive(PrimitiveType.Plane);

        //    go.renderer.material.SetTexture("_MainTex", TopNameMovie.TopNameRenderTexture);
        //}

        return(t);
    }
Exemplo n.º 4
0
    /// <summary>
    /// 获取血条
    /// </summary>
    /// <param name="entity_Type"></param>
    /// <param name="isHero"></param>
    /// <param name="moveNode"></param>
    /// <returns></returns>
    static GfxBlood GetBlood(ENTITY_TYPE entity_Type, bool isHero, ref MovieNode moveNode)
    {
        GfxBlood gb   = null;
        string   name = m_entiyTypeMap[entity_Type];

        if (isHero) //主角直接创建
        {
            if (!AllocBloodPos(entity_Type, ref moveNode))
            {
                //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!");
                return(null);
            }

            name = PlayerSelfBloodAS3RefrenceName;
            gb   = CreateBloodInstance(name);

            return(gb);
        }

        if (!OptimitzedControlPlane.Instance.EnityCreateOptimize)
        {
            if (!AllocBloodPos(entity_Type, ref moveNode))
            {
                //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!");
                return(null);
            }
            gb = CreateBloodInstance(name);
            return(gb);
        }

        if (!m_CacheBlood.ContainsKey(entity_Type))
        {
            moveNode = new MovieNode();
            return(gb);
        }
        else
        {
            Queue <GfxBlood> m_CacheList = m_CacheBlood[entity_Type];
            if (m_CacheList.Count > 0)
            {
                gb = m_CacheList.Dequeue();
                gb.SetEnable(true);
                moveNode = gb.movieNode;
            }
            else
            {
                if (!AllocBloodPos(entity_Type, ref moveNode))
                {
                    //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!");
                    return(null);
                }
                gb = CreateBloodInstance(name);
            }
        }
        return(gb);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 为血条分配一个位置,分配失败,则表示Movie已经满了。
    /// </summary>
    /// <param name="t"></param>
    /// <returns></returns>
    private static bool AllocBloodPos(ENTITY_TYPE t, ref MovieNode btr)
    {
        if (m_entiySizeMap.ContainsKey(t))
        {
            Vector2 BloodSize = m_entiySizeMap[t];
            btr.isValid = false;
            if (UnUsedMovieNodeList.Count > 0)
            {
                MovieNode bt = UnUsedMovieNodeList.Dequeue();
                btr.RowIndex = bt.RowIndex;
                btr.ColIndex = bt.ColIndex;

                btr.start.x = MovieCell_Width * bt.RowIndex;
                btr.start.y = MovieCell_Height * bt.ColIndex;

                btr.end.x = btr.start.x + BloodSize.x;
                btr.end.y = btr.start.y + BloodSize.y;
                btr.vSize = BloodSize;

                btr.isValid = true;
            }
            else
            {
                btr         = new MovieNode();
                btr.start.x = MovieCell_Width * CurrentRowIndex;
                btr.start.y = MovieCell_Height * CurrentColIndex;

                btr.end.x = btr.start.x + BloodSize.x;
                btr.end.y = btr.start.y + BloodSize.y;
                btr.vSize = BloodSize;


                btr.RowIndex = CurrentRowIndex;
                btr.ColIndex = CurrentColIndex;

                CurrentRowIndex++;
                if (CurrentRowIndex >= MaxRowCount)
                {
                    CurrentColIndex++;
                    if (CurrentColIndex >= MaxColCount)
                    {
                        return(false);
                    }
                    CurrentRowIndex = 0;
                }

                btr.isValid = true;
            }
            return(true);
        }

        return(false);
    }
Exemplo n.º 6
0
        void HandleTreeviewRowActivated(object o, RowActivatedArgs args)
        {
            TreeIter iter;

            store.GetIter(out iter, args.Path);
            MovieNode movienode = store.GetValue(iter, 0) as MovieNode;

            if (movienode == null)
            {
                return;
            }
            if (ItemActivated != null && movienode.Meta != null)
            {
                ItemActivated(movienode.Meta);
            }
        }
Exemplo n.º 7
0
    /// <summary>
    /// 为头顶名分配一个位置,分配失败,则表示Movie已经满了。
    /// </summary>
    /// <param name="btr"></param>
    /// <returns></returns>
    private static bool AllocTopNamePos(ref MovieNode btr)
    {
        btr.isValid = false;
        if (UnUsedMovieNodeList.Count > 0)
        {
            MovieNode bt = UnUsedMovieNodeList.Dequeue();
            btr.RowIndex = bt.RowIndex;
            btr.ColIndex = bt.ColIndex;

            btr.start.x = MovieCell_Width * bt.RowIndex;
            btr.start.y = MovieCell_Height * bt.ColIndex;

            btr.end.x = btr.start.x + TopNameSize.x;
            btr.end.y = btr.start.y + TopNameSize.y;
            btr.vSize = TopNameSize;

            btr.isValid = true;
        }
        else
        {
            btr.start.x = MovieCell_Width * CurrentRowIndex;
            btr.start.y = MovieCell_Height * CurrentColIndex;

            btr.end.x = btr.start.x + TopNameSize.x;
            btr.end.y = btr.start.y + TopNameSize.y;
            btr.vSize = TopNameSize;


            btr.RowIndex = CurrentRowIndex;
            btr.ColIndex = CurrentColIndex;

            CurrentRowIndex++;
            if (CurrentRowIndex >= MaxRowCount)
            {
                CurrentColIndex++;
                if (CurrentColIndex >= MaxColCount)
                {
                    return(false);
                }
                CurrentRowIndex = 0;
            }

            btr.isValid = true;
        }
        return(true);
    }
Exemplo n.º 8
0
        public MovieMeta[] GetSelected()
        {
            List <MovieMeta> results = new List <MovieMeta>();
            TreeIter         iter;

            TreePath[] paths = treeview.Selection.GetSelectedRows();
            foreach (TreePath path in paths)
            {
                store.GetIter(out iter, path);
                MovieNode node = store.GetValue(iter, 0) as MovieNode;
                if (node != null)
                {
                    Logger.Log("Selected Movie: {0}", node.Filename);
                    results.Add(node.Meta);
                }
            }
            return(results.ToArray());
        }
Exemplo n.º 9
0
    public void ChangeMovieNode(MovieNode trs)
    {
        if (!m_BillBorad)
        {
            return;
        }
        m_MovieNode = trs;
        Vector2 pos = m_MovieNode.start;

        pos.x += m_MovieNode.vSize.x * 0.5f;
        pos.y += m_MovieNode.vSize.y * 0.5f;
        SetPositionDirectly_StagePoint(pos);

        m_BillBorad.SetPixelSize((int)m_MovieNode.vSize.x, (int)m_MovieNode.vSize.y);
        GfxBloodMovie.TransformBillBorad(m_BillBorad);
        Vector2 texStart = GfxBloodMovie.TransformTextureOffsetFromPixelPos(m_MovieNode.start);
        Vector2 texEnd   = GfxBloodMovie.TransformTextureOffsetFromPixelPos(m_MovieNode.end);

        m_BillBorad.SetTextureOffset(texStart, texEnd);

        ChangeParent(m_entry.transform);
    }
Exemplo n.º 10
0
    public void ChangeMovieNode(MovieNode trs)
    {
        if (!m_BillBorad)
        {
            return;
        }

        m_MovieNode = trs;
        Vector2 pos = m_MovieNode.start;

        pos.x += m_MovieNode.vSize.x * 0.5f;
        pos.y += m_MovieNode.vSize.y * 0.5f;

        SetPositionDirectly_StagePoint(pos);

        TopNameMovie.TransformBillBorad(m_BillBorad);
        Vector2 texStart = TopNameMovie.TransformTextureOffsetFromPixelPos(m_MovieNode.start);
        Vector2 texEnd   = TopNameMovie.TransformTextureOffsetFromPixelPos(m_MovieNode.end);

        m_BillBorad.SetTextureOffset(texStart, texEnd);
        m_BillBorad.transform.parent        = m_entry.transform;
        m_BillBorad.transform.localPosition = new Vector3(0.0f, m_EntryProperty.CreatureHeightInMeters, 0.0f);
    }
Exemplo n.º 11
0
    /// <summary>
    /// 创建一个Blood,返回一个GfxBlood实例,失败返回null
    /// </summary>
    /// <param name="entityID">实体ID</param>
    /// <param name="Host">实体</param>
    /// <param name="campType">阵营类型</param>
    /// <param name="CurValue">当前值</param>
    /// <param name="MaxValue">最大值</param>
    public static GfxBlood CreateBlood(U3D_Render.EntityView objev, int entityID, GameObject Host, int campType, int CurValue = 100, int MaxValue = 100)
    {
        if (SFGFxMovieManager.Instance == null)
        {
            Trace.LogError("SFGFxMovieManager没有初始化,请不要在Awake中创建!");
            return(null);
        }
        if (!bInit)
        {
            Trace.LogError("GfxBloodManager必须初始化!");
            return(null);
        }
        //有可能GfxBloodMovie还没有创建完成.
        if (GfxBloodMovie.Instance == null)
        {
            //Trace.LogError("GfxBloodMovie尚未创建完成,请等待创建完成后再调用。");
            return(null);
        }

        CreateBossBlood();

        if (!objev.IsValid)
        {
            Trace.LogWarning("实体视图无效!id=" + entityID);
            return(null);
        }

        if (m_BloodMap.ContainsKey(entityID))
        {
            Trace.LogWarning(entityID + "已经有血条,返回已有的实例");
            GfxBlood gba = m_BloodMap[entityID];
            return(gba);
        }

        CurValue = Mathf.Clamp(CurValue, 0, MaxValue);


        ENTITY_TYPE entityType = objev.Type;

        if (!m_entiyTypeMap.ContainsKey(entityType))
        {
            Trace.LogWarning(entityID + "找不到实体类型:" + entityType + "使用怪物类型代替,请在GfxBloodManager::Init()中添加");
            entityType = ENTITY_TYPE.TYPE_MONSTER;
        }

        //按照策划要求,目前不创建己方小兵血条,其他己方物体不变
        if (objev.Flag == (int)EWarMonsterExec.EWME_Soldier && campType == (int)GFxCampManager.GFxCampTpye.CT_Friend)
        {
            return(null);
        }

        MovieNode trs = new MovieNode();
        GfxBlood  gb  = GetBlood(entityType, entityID == EntityFactory.MainHeroID, ref trs);

        if (null == gb)
        {
            return(null);
        }
        gb.Init(entityID, Host, campType, entityType);
        gb.CreateBillBorad();
        //获取最大值和当前值
        MaxValue = objev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_MAX_HP);
        CurValue = objev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_HP);

        gb.SetMaxValue(MaxValue);
        gb.SetCurValue(CurValue);

        //设置一下血量数字信息
        string bloodInfo = CurValue + "/" + MaxValue;

        gb.SetBloodInfo(bloodInfo);

        //设置血量数字信息是否显示,通过读取本地配置文件
        gb.SetBloodInfoVisible(bBloodInfoVisible);

        //判断一下如果是主角,则通过读取本地配置文件,设置主角血量是否显示
        if (entityID == EntityFactory.MainHeroID)
        {
            //读取本地配置文件,获取玩家血条是否需要显示
            bPlayerBloodVisible = ASpeedGame.Data.GameSettingsXml.GameSettingsXmlManager.Instance.GameSettingsModel.showPlayerBlood.AValue;
            gb.SetPlayerVisible(bPlayerBloodVisible);
        }

        gb.ChangeMovieNode(trs);
        m_BloodMap.Add(entityID, gb);
        ChangeMask(objev, true);
        //if (!go)
        //{
        //    go = GameObject.CreatePrimitive(PrimitiveType.Plane);

        //    go.GetComponent<Renderer>().sharedMaterial.SetTexture("_MainTex", GfxBloodMovie.BloodRenderTexture);
        //}
        if (entityType == ENTITY_TYPE.TYPE_PLAYER_ROLE && entityID != EntityFactory.MainHeroID)
        {
            setHeroProperty(objev);
        }
        return(gb);
    }
Exemplo n.º 12
0
    public static void PreWarmBlood()
    {
        if (bPreWarmBlood)
        {
            return;
        }
        bPreWarmBlood = true;
        Queue <GfxBlood> MonsterList = m_CacheBlood[ENTITY_TYPE.TYPE_MONSTER];

        for (int i = 0; i < MonsterCacheCout; i++)
        {
            MovieNode moveNode = new MovieNode();
            if (!AllocBloodPos(ENTITY_TYPE.TYPE_MONSTER, ref moveNode))
            {
                //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!");
                continue;
            }
            GfxBlood gb = CreateBloodInstance(MonsterBloodAS3RefrenceName);
            gb.Init(-1, CacheBloodRoot, -1, ENTITY_TYPE.TYPE_MONSTER);
            gb.CreateBillBorad();
            gb.ChangeParent(CacheBloodRoot.transform);
            gb.SetEnable(false);
            gb.ChangeMovieNode(moveNode);

            MonsterList.Enqueue(gb);
        }

        Queue <GfxBlood> PlayerList = m_CacheBlood[ENTITY_TYPE.TYPE_PLAYER_ROLE];

        for (int i = 0; i < PlayerCacheCout; i++)
        {
            MovieNode moveNode = new MovieNode();
            if (!AllocBloodPos(ENTITY_TYPE.TYPE_PLAYER_ROLE, ref moveNode))
            {
                //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!");
                continue;
            }

            GfxBlood gb = CreateBloodInstance(PlayerBloodAS3RefrenceName);
            gb.Init(-1, CacheBloodRoot, -1, ENTITY_TYPE.TYPE_PLAYER_ROLE);

            gb.SetMaxValue(100);
            gb.SetCurValue(100);
            gb.CreateBillBorad();
            gb.ChangeParent(CacheBloodRoot.transform);
            gb.SetEnable(false);
            gb.ChangeMovieNode(moveNode);
            PlayerList.Enqueue(gb);
        }

        Queue <GfxBlood> TankList = m_CacheBlood[ENTITY_TYPE.TYPE_TANK];

        for (int i = 0; i < TankCacheCout; i++)
        {
            MovieNode moveNode = new MovieNode();
            if (!AllocBloodPos(ENTITY_TYPE.TYPE_TANK, ref moveNode))
            {
                //Debug.LogWarning("Movie空间不足,最多只能容纳:" + MaxColCount * MaxRowCount + "个血条!!");
                continue;
            }
            GfxBlood gb = CreateBloodInstance(BuildingsBloodAS3RefrenceName);
            gb.Init(-1, CacheBloodRoot, -1, ENTITY_TYPE.TYPE_TANK);
            gb.SetMaxValue(100);
            gb.SetCurValue(100);
            gb.CreateBillBorad();
            gb.ChangeParent(CacheBloodRoot.transform);
            gb.SetEnable(false);
            gb.ChangeMovieNode(moveNode);
            TankList.Enqueue(gb);
        }
    }
Exemplo n.º 13
0
        protected virtual void RenderTreeCell(Gtk.TreeViewColumn _column, Gtk.CellRenderer _cell, Gtk.TreeModel _model, Gtk.TreeIter _iter)
        {
            object    o    = _model.GetValue(_iter, 0);
            MovieNode node = o as MovieNode;

            Gdk.Color background = new Gdk.Color(255, 255, 255);
            if (node != null && (_model.GetPath(_iter).Indices[1] % 2) == 0)
            {
                background = new Gdk.Color(240, 240, 255);
            }
            if (_cell is Gtk.CellRendererText)
            {
                if (node != null)
                {
                    switch (_column.SortColumnId)
                    {
                    case 0: (_cell as Gtk.CellRendererText).Text = node.Title; break;

                    case 1: (_cell as Gtk.CellRendererText).Text = node.Year; break;

                    case 2: (_cell as Gtk.CellRendererText).Text = node.Set; break;

                    case 4: (_cell as Gtk.CellRendererText).Text = node.Filename; break;
                    }
                }
                else if (o is KeyNode && _column.SortColumnId == 0)
                {
                    (_cell as Gtk.CellRendererText).Markup = ((KeyNode)o).Markup;
                }
                else
                {
                    (_cell as Gtk.CellRendererText).Text = "";
                }
                (_cell as Gtk.CellRendererText).BackgroundGdk = background;
            }
            else if (_cell is TreeItemCellRenderer)
            {
                TreeItemCellRenderer render = (TreeItemCellRenderer)_cell;
                render.CellBackgroundGdk = background;
                render.Pixbuf            = null;
                if (node != null)
                {
                    render.Text   = node.Title;
                    render.Pixbuf = node.StatusIcon;
                }
                else
                {
                    render.Text = ((KeyNode)o).Key;
                }
            }
            else
            {
                if (node != null)
                {
                    switch (_column.SortColumnId)
                    {
                    case 0: (_cell as Gtk.CellRendererPixbuf).Pixbuf = node.StatusIcon; break;

                    case 3: (_cell as Gtk.CellRendererPixbuf).Pixbuf = node.RatingIcon; break;
                    }
                }
                else
                {
                    (_cell as Gtk.CellRendererPixbuf).Pixbuf = Images.Empty;
                }
                (_cell as Gtk.CellRendererPixbuf).CellBackgroundGdk = background;
            }
        }