// 显示信息
    public void ShowInfo(ISoldier Soldier)
    {
        //Debug.Log("显示Soldier信息");
        m_Soldier = Soldier;
        if (m_Soldier == null || m_Soldier.IsKilled())
        {
            Hide();
            return;
        }
        Show();

        // 显示Soldier信息
        // Icon
        IAssetFactory Factory = PBDFactory.GetAssetFactory();

        m_Icon.sprite = Factory.LoadSprite(m_Soldier.GetIconSpriteName());
        // 名称
        m_NameTxt.text = m_Soldier.GetName();
        // 等级
        m_LvTxt.text = string.Format("等级:{0}", m_Soldier.GetSoldierValue().GetSoldierLv());
        // Atk
        m_AtkTxt.text = string.Format("攻击力:{0}", m_Soldier.GetWeapon().GetAtkValue());
        // Atk距离
        m_AtkRangeTxt.text = string.Format("攻击距离:{0}", m_Soldier.GetWeapon().GetAtkRange());
        // Speed
        m_SpeedTxt.text = string.Format("移动速度:{0}", m_Soldier.GetSoldierValue().GetMoveSpeed());;

        // 更新HP信息
        RefreshHPInfo();
    }
    // 显示信息
    public void ShowInfo(ICamp Camp)
    {
        //Debug.Log("显示兵营信息");
        Show();
        m_Camp = Camp;

        // 名称
        m_CampNameTxt.text = m_Camp.GetName();
        // 训练花费
        m_TrainCostText.text = string.Format("AP:{0}", m_Camp.GetTrainCost());
        // 训练中信息
        ShowOnTrainInfo();
        // Icon
        IAssetFactory Factory = PBDFactory.GetAssetFactory();

        m_CampImage.sprite = Factory.LoadSprite(m_Camp.GetIconSpriteName());

        // 升級功能
        if (m_Camp.GetLevel() <= 0)
        {
            EnableLevelInfo(false);
        }
        else
        {
            EnableLevelInfo(true);
            m_CampLvTxt.text = string.Format("等级:" + m_Camp.GetLevel());
            ShowWeaponLv();            // 显示武器等级
        }
    }
示例#3
0
    // 建立武器
    public override IWeapon CreateWeapon(ENUM_Weapon emWeapon)
    {
        IWeapon pWeapon   = null;
        string  AssetName = "";
        int     AttrID    = 0;

        //根据武器类型建立
        switch (emWeapon)
        {
        case ENUM_Weapon.Knife:
            pWeapon   = new WeaponKnife();
            AssetName = "5";
            AttrID    = 1;
            break;

        default:
            Debug.LogWarning("创建[" + emWeapon + "]失败!!!");
            return(null);
        }

        // 加载武器资源
        IAssetFactory AssetFactory    = GameFactory.GetAssetFactory();
        Sprite        WeaponGameObjet = AssetFactory.LoadWeapon(AssetName);

        pWeapon.SetIWeapon(WeaponGameObjet);

        // 设置武器的威力
        IAttrFactory theAttrFactory = GameFactory.GetAttrFactory();
        WeaponAttr   theWeaponAttr  = theAttrFactory.GetWeaponAttr(AttrID);

        pWeapon.SetWeaponAttr(theWeaponAttr);

        return(pWeapon);
    }
示例#4
0
        public void ShowInfo(ICamp Camp)
        {
            Show();
            m_Camp = Camp;

            // 名称
            m_CampNameTxt.text = m_Camp.GetName();
            // 训练花费
            m_TrainCostTxt.text = string.Format("AP:{0}", m_Camp.GetTrainCost());

            // 训练中信息
            ShowOnTrainInfo();
            // Icon
            IAssetFactory Factory = RTSFactory.GetAssetFactory();

            m_CampImage.sprite = Factory.LoadSprite(m_Camp.GetIconSpriteName());

            // 升级功能
            if (m_Camp.GetLevel() <= 0)
            {
                EnableLevelInfo(false);
            }
            else
            {
                EnableLevelInfo(true);
                m_CampLvTxt.text   = string.Format("等级:" + m_Camp.GetLevel());
                m_WeaponLvTxt.text = string.Format("武器等级:" + m_Camp.GetWeaponLevel());
            }
        }
    // 顯示資訊
    public void ShowInfo(ISoldier Soldier)
    {
        //Debug.Log("顯示Soldier資訊");
        m_Soldier = Soldier;
        if (m_Soldier == null || m_Soldier.IsKilled())
        {
            Hide();
            return;
        }
        Show();

        // 顯示Soldier資訊
        // Icon
        IAssetFactory Factory = PBDFactory.GetAssetFactory();

        m_Icon.sprite = Factory.LoadSprite(m_Soldier.GetIconSpriteName());
        // 名稱
        m_NameTxt.text = m_Soldier.GetName();
        // 等級
        m_LvTxt.text = string.Format("等級:{0}", m_Soldier.GetSoldierValue().GetSoldierLv());
        // Atk
        m_AtkTxt.text = string.Format("攻擊力:{0}", m_Soldier.GetWeapon().GetAtkValue());
        // Atk距離
        m_AtkRangeTxt.text = string.Format("攻擊距離:{0}", m_Soldier.GetWeapon().GetAtkRange());
        // Speed
        m_SpeedTxt.text = string.Format("移動速度:{0}", m_Soldier.GetSoldierValue().GetMoveSpeed());;

        // 更新HP資訊
        RefreshHPInfo();
    }
示例#6
0
 /// <summary>
 /// 创建资源工厂
 /// </summary>
 /// <returns></returns>
 public static IAssetFactory GetAssetFactory()
 {
     if (AssetFactory == null)
     {
         AssetFactory = new AssetFactory();
     }
     return(AssetFactory);
 }
示例#7
0
 public static IAssetFactory getAssetFactory()
 {
     if (m_assetFactory == null)
     {
         m_assetFactory = new ResourceAssetFactory();
     }
     return(m_assetFactory);
 }
示例#8
0
 public Broker(IAssetFactory factory, IMarket market, IOManager consoleManager, IPrinterManager printerManager, IUserSession userSession)
 {
     this.Factory    = factory;
     this.MarketProp = market;
     ConsoleManager  = consoleManager;
     PrinterManager  = printerManager;
     UserSession     = userSession;
 }
示例#9
0
        public override void LoadAsset(int GameObjectID)
        {
            IAssetFactory AssetFactory    = RTSFactory.GetAssetFactory();
            GameObject    EnemyGameObject = AssetFactory.LoadEnemy(m_BuildParam.NewCharacter.GetAssetName());

            EnemyGameObject.transform.position = m_BuildParam.SpawnPosition;
            EnemyGameObject.name = string.Format("Enemy[{0}]", GameObjectID);
            m_BuildParam.NewCharacter.SetGameObject(EnemyGameObject);
        }
示例#10
0
    // 载入Asset中的角色模型
    public override void LoadAsset(int GameObjectID)
    {
        IAssetFactory AssetFactory      = PBDFactory.GetAssetFactory();
        GameObject    SoldierGameObject = AssetFactory.LoadSoldier(m_BuildParam.NewCharacter.GetAssetName());

        SoldierGameObject.transform.position = m_BuildParam.SpawnPosition;
        SoldierGameObject.gameObject.name    = string.Format("Soldier[{0}]", GameObjectID);
        m_BuildParam.NewCharacter.SetGameObject(SoldierGameObject);
    }
示例#11
0
        public static IAssetFactory GetAssetFactory()
        {
            if (_assetFactory == null)
            {
                _assetFactory = new ResourcesProxyFactory();
            }

            return(_assetFactory);
        }
示例#12
0
 public static IAssetFactory GetAssetFactory()
 {
     if (m_AssetFactory == null)
     {
         if (m_bLoadFromResource)
         {
             m_AssetFactory = new ResourceAssetProxyFactory();
         }
     }
     return(m_AssetFactory);
 }
示例#13
0
    /// <summary>
    /// 建造兵营
    /// </summary>
    public void CreatBuding(string name)
    {
        if (campNow != null)
        {
            return;
        }
        IAssetFactory factory = PBDGFactory.GetAssetFactory();

        campNow = factory.CreatBuding(name);
        // m_PBDGame.Add(campNow, "建筑物");
    }
示例#14
0
    /// <summary>
    /// 播放音效
    /// </summary>
    /// <param name="ClipName"></param>
    public void PlaySound(string ClipName)
    {
        //  取得音效
        IAssetFactory Factory = GameFactory.GetAssetFactory();
        AudioClip     theClip = Factory.LoadAudioClip(ClipName);

        if (theClip == null)
        {
            return;
        }
    }
示例#15
0
    // 播放音效
    public void playSound(string ClipName)
    {
        IAssetFactory factory = FactoryManager.getAssetFactory();
        AudioClip     theClip = factory.loadAudioClip(ClipName);

        if (theClip == null)
        {
            return;
        }
        m_audio.clip = theClip;
        m_audio.Play();
    }
示例#16
0
	// 取得將Unity Asset實作化的工廠
	public static IAssetFactory GetAssetFactory()
	{
		if( m_AssetFactory == null)
		{
			if( m_bLoadFromResource)
				//m_AssetFactory = new ResourceAssetFactory();
				m_AssetFactory = new ResourceAssetProxyFactory(); 
			else
				m_AssetFactory = new RemoteAssetFactory();
		}
		return m_AssetFactory;
	}
示例#17
0
    // 播放音效
    public void PlaySound(string ClipName)
    {
        //  取得音效
        IAssetFactory Factory = PBDFactory.GetAssetFactory();
        AudioClip     theClip = Factory.LoadAudioClip(ClipName);

        if (theClip == null)
        {
            return;
        }
        m_Audio.clip = theClip;
        m_Audio.Play();
    }
示例#18
0
    // 播放特效
    public void playEffect(string EffectName)
    {
        //  取得特效
        IAssetFactory factory   = FactoryManager.getAssetFactory();
        GameObject    effectObj = factory.loadEffect(EffectName);

        if (effectObj == null)
        {
            return;
        }

        // 将特效附加到当前角色对象
        UnityTool.attach(m_gameObject, effectObj, Vector3.zero);
    }
示例#19
0
    /// <summary>
    /// 播放特效
    /// </summary>
    /// <param name="EffectName"></param>
    public void PlayEffect(string EffectName)
    {
        //  取得特效
        IAssetFactory Factory   = GameFactory.GetAssetFactory();
        GameObject    EffectObj = Factory.LoadEffect(EffectName);

        if (EffectObj == null)
        {
            return;
        }

        //附加到游戏物体上
        UnityTool.Attach(m_GameObject, EffectObj, Vector3.zero);
    }
 public static IAssetFactory GetAssetFactory()
 {
     if (m_assetFactory == null)
     {
         if (m_bLoadFromResource)
         {
             m_assetFactory = new ResourceAssetFactory();
         }
         else
         {
             m_assetFactory = new RemoveAssetFactory();
         }
     }
     return(m_assetFactory);
 }
示例#21
0
    // 建立武器
    public override IWeapon CreateWeapon(ENUM_Weapon emWeapon)
    {
        IWeapon pWeapon   = null;
        string  AssetName = "";         // Unity模型名称
        int     AttrID    = 0;          // 武器的能力值

        // 依武器
        switch (emWeapon)
        {
        case ENUM_Weapon.Gun:
            pWeapon   = new WeaponGun();
            AssetName = "WeaponGun";
            AttrID    = 1;
            break;

        case ENUM_Weapon.Rifle:
            pWeapon   = new WeaponRifle();
            AssetName = "WeaponRifle";
            AttrID    = 2;
            break;

        case ENUM_Weapon.Rocket:
            pWeapon   = new WeaponRocket();
            AssetName = "WeaponRocket";
            AttrID    = 3;
            break;

        default:
            Debug.LogWarning("CreateWeapon:无法建立[" + emWeapon + "]");
            return(null);
        }

        // 产生Asset
        IAssetFactory AssetFactory    = PBDFactory.GetAssetFactory();
        GameObject    WeaponGameObjet = AssetFactory.LoadWeapon(AssetName);

        pWeapon.SetGameObject(WeaponGameObjet);

        // 取得武器的威力
        IAttrFactory theAttrFactory = PBDFactory.GetAttrFactory();
        WeaponAttr   theWeaponAttr  = theAttrFactory.GetWeaponAttr(AttrID);

        // 设定武器的威力
        pWeapon.SetWeaponAttr(theWeaponAttr);

        return(pWeapon);
    }
        public IAssetFactory<Asset> GetFactory()
        {
            if (factory != null)
                return factory;

            if (FactoryTypeName != null)
            {
                factory = AssetRegistry.GetAssetFactory(FactoryTypeName);
            }
            else
            {
                var assetType = GetAssetType();
                var factoryType = typeof(DefaultAssetFactory<>).MakeGenericType(assetType);
                factory = (IAssetFactory<Asset>)Activator.CreateInstance(factoryType);
            }
            return factory;
        }
示例#23
0
    public override void LoadAsset()
    {
        IAssetFactory Factory           = PBDGFactory.GetAssetFactory();
        GameObject    soliderGameObject = Factory.CreatSolider("prefab", m_buildParam.AssetName);

        soliderGameObject.transform.position = m_buildParam.Position;
        soliderGameObject.gameObject.name    = "Soldier";
        m_buildParam.NewBuding.SetGameObject(soliderGameObject);



        if (m_pBDG != null)
        {
            m_pBDG.AddSolider(m_buildParam.NewBuding as ISolider);
            m_pBDG.Add(soliderGameObject, "工兵");
        }
    }
示例#24
0
    // 顯示音效
    protected void ShowSoundEffect(string ClipName)
    {
        if (m_Audio == null)
        {
            return;
        }

        //  取得音效
        IAssetFactory Factory = PBDFactory.GetAssetFactory();
        AudioClip     theClip = Factory.LoadAudioClip(ClipName);

        if (theClip == null)
        {
            return;
        }
        m_Audio.clip = theClip;
        m_Audio.Play();
    }
示例#25
0
        public IAssetFactory <Asset> GetFactory()
        {
            if (factory != null)
            {
                return(factory);
            }

            if (FactoryTypeName != null)
            {
                factory = AssetRegistry.GetAssetFactory(FactoryTypeName);
            }
            else
            {
                var assetType   = GetAssetType();
                var factoryType = typeof(DefaultAssetFactory <>).MakeGenericType(assetType);
                factory = (IAssetFactory <Asset>)Activator.CreateInstance(factoryType);
            }
            return(factory);
        }
 public AssetManager(
     IAssetStorageProvider assetStoragePRovider,
     IRepository <AssetRecord> assetRepository,
     IContentManager contentManager,
     IClock clock,
     IMimeTypeProvider mimeTypeProvider,
     ITempFileManager fileManager,
     IWamsClient wamsClient,
     IAssetFactory factory)
 {
     _assetStorageProvider = assetStoragePRovider;
     _assetRepository      = assetRepository;
     _contentManager       = contentManager;
     _clock            = clock;
     _mimeTypeProvider = mimeTypeProvider;
     _fileManager      = fileManager;
     _wamsClient       = wamsClient;
     _factory          = factory;
 }
示例#27
0
    public CampSystem(PBDG_GameMain pBDG_Game) : base(pBDG_Game)
    {
        //数据可以是在配置表中取

        //兵营
        Camp camp1 = new Camp("Camp", 5, 2000, "Camp", "RookieCamp", false, "工兵");
        Camp camp2 = new Camp("Camp", 5, 2000, "Camp", "RookieCamp", false, "坦克");

        //所有数据先初始化
        campsList.Add(camp1);
        campsList.Add(camp2);

        for (int i = 0; i < 10; i++)
        {
            IAssetFactory factory = PBDGFactory.GetAssetFactory();
            GameObject    temp    = factory.CreatBuding("CaptiveCamp");
            temp.transform.position = new Vector3(Random.Range(-50, 50), 3.7f, Random.Range(-50, 50));
            pBDG_Game.Add(temp, "建筑物");
        }
    }
示例#28
0
    //刷新显示
    public void RefreshShow()
    {
        //先获取所有兵营的信息
        List <ICamp> camps = pBDG_Game.GetCampList();

        for (int i = 0; i < camps.Count;)
        {
            GameObject temp = null;
            if (content.childCount > 0 && content.childCount - 1 >= i)
            {
                temp = content.GetChild(i).gameObject;
            }
            else
            {
                IAssetFactory Factory = PBDGFactory.GetAssetFactory();
                temp = Factory.Creat("prefab", "image_camp");
                temp.transform.SetParent(content, false);

                Button tempBtn = temp.GetComponent <Button>();
                tempBtn.onClick.AddListener(() =>
                {
                    pBDG_Game.CreatBuding(tempBtn.name);
                });
            }
            if (temp != null)
            {
                temp.name = camps[i].GetName();
                temp.GetComponent <Image>().sprite = ResourcesManager.Instance.Load <Sprite>("Sprites", camps[i].GetImage(), false);
            }

            if (camps[i].GetIsShow())
            {
                i++;
            }
            else
            {
                break;
            }
        }
    }
示例#29
0
 public BrokerMock(IAssetFactory factory, IMarket market, IUserSession userSession)
 {
     this.Factory    = factory;
     this.MarketProp = market;
     UserSession     = userSession;
 }
示例#30
0
 public ReleaseAssetsProcess(IAssetFactory assetFactory)
 {
     _assetFactory = assetFactory;
 }
 public AssetSerializer(IAssetFactory assetFactory)
 {
     this.assetFactory = assetFactory;
 }
示例#32
0
 /// <summary>
 /// Registers a <see cref="IAssetFactory" /> for the specified asset type.
 /// </summary>
 /// <param name="assetType">Type of the asset.</param>
 /// <param name="factory">The factory.</param>
 public static void RegisterFactory(Type assetType, IAssetFactory factory)
 {
     AssertAssetType(assetType);
     RegisteredFactories[assetType] = factory;
 }