private void InitItemList()
        {
            GameObject itemObj;

            foreach (var id in itemIdList)
            {
                var itemInfo = ItemMgr.Instance.GetItem(id);
                itemObj = MemoryMgr.InstantiateGameObject(UiPath.Image_ItemUI, this.itemList);
                Assert.IsTrue(itemObj);


                var avator = itemObj.transform.Find("Image_ItemAvator");
                if (avator == null)
                {
                    throw new Exception("avator is null");
                }
                var image = avator.GetComponent <Image>();
                if (image == null)
                {
                    throw new Exception("Image is null");
                }
                image.sprite =
                    MemoryMgr.GetSourceFromResources <Sprite>(itemInfo.SpritePath);
                itemObj.transform.Find("Tmp_Price").GetComponent <TextMeshProUGUI>().text = itemInfo.Price.ToString();

                this.items.Add(itemObj);
            }
        }
Exemplo n.º 2
0
    void Start()
    {
        print("Normal_Start");

        GameMgr.Instance.PlayerPos = this.PlayerPos;

        if (enableMiniMap)
        {
            MemoryMgr.InstantiateGameObject(DirPath.LittleUiDir + UiName.Image_MiniMap, GlobalVar.G_Canvas.transform);
        }

        if (!string.IsNullOrEmpty(UiPanelName))
        {
            PanelMgr.PushPanel(UiPanelName);
            if (UiPanelName == PanelName.battlePanel)
            {
                CEventCenter.BroadMessage(Message.M_RankAwake, 0, 0);
            }
        }

        if (creatTestPeople)
        {
            new TestPerson("Test", DirPath.GameObjectDir + GameObjectName.TestPerson, EnemyPos);
        }
    }
Exemplo n.º 3
0
 private void Awake()
 {
     print("Normal_Awake");
     if (GameObject.FindGameObjectsWithTag("GameController").Length <= 0)
     {
         MemoryMgr.InstantiateGameObject(DirPath.GameObjectDir + GameObjectName.GameMgr);
     }
 }
 protected AbstractSpriteObj(string path, Vector3 pos, Transform parent = null)
 {
     obj = MemoryMgr.InstantiateGameObject(path, pos, Quaternion.identity, parent);
     if (obj == null)
     {
         throw new Exception("子弹生成失败");
     }
     MainLoop.Instance.AddUpdateFunc(Update);
 }
Exemplo n.º 5
0
        /// <summary>
        /// 实例化UI物体,加图片,为变量itemImage,itemNum赋值
        /// </summary>
        private void FillSlot()
        {
            if (this == null)
            {
                throw new Exception("????????????");
            }

            this.itemUi.obj = MemoryMgr.InstantiateGameObject(UiName.Image_ItemUI, transform);
            this.itemImage  = this.itemUi.obj.GetComponent <Image>();
            Assert.IsTrue(this.itemImage);
            this.itemImage.sprite = MemoryMgr.GetSourceFromResources <Sprite>(this.itemUi.SpritePath);
            this.itemNum          = this.itemUi.obj.GetComponentInChildren <Text>();
            Assert.IsTrue(this.itemNum);
        }
Exemplo n.º 6
0
        void Start()
        {
            if (enableMiniMap)
            {
                MemoryMgr.InstantiateGameObject(UiPath.Image_MiniMapBackGround,
                                                GlobalVar.G_Canvas.transform);
            }


            if (PanelUiAsset != null)
            {
                PanelAssetMgr.PushPanel(PanelUiAsset);
            }
            CEventCenter.BroadMessage(Message.M_RankAwake, 0, 0);
        }
Exemplo n.º 7
0
        private void InitItemList()
        {
            GameObject itemObj;

            foreach (var id in itemIdList)
            {
                itemObj = MemoryMgr.InstantiateGameObject(DirPath.LittleUiDir + this.itemDataPath, this.itemList);
                Assert.IsTrue(itemObj);
                var itemInfo = ItemMgr.GetItem <AbstractCommodity>(id);
                itemObj.transform.Find("Image_ItemAvator").GetComponent <Image>().sprite =
                    MemoryMgr.GetSourceFromResources <Sprite>(itemInfo.SpritePath);
                itemObj.transform.Find("Tmp_Price").GetComponent <TextMeshProUGUI>().text = itemInfo.price.ToString();

                this.items.Add(itemObj);
            }
        }
        public AbstractPerson(BaseCharacterInfo characterInfo, Vector3 pos, Transform parent = null)
        {
            this.characterInfoInfo = characterInfo;

            this.obj = MemoryMgr.InstantiateGameObject(characterInfo.prefabPath.Path, pos, Quaternion.identity, parent);
            this.Hp  = characterInfo.maxHp;

            //添加事件监听
            OnAddListener();

            //开始每帧Update
            MainLoop.Instance.AddUpdateFunc(Update);

            //记录每个实例
            instanceList.Add(this);
        }
Exemplo n.º 9
0
        public AbstractPerson(string name, string prefabPath, Vector3 pos, List <string> skillTypes = null, Transform parent = null)
        {
            //初始化默认属性
            this.name             = name;
            this.InputOk          = true;
            this.IsConst          = false;
            this.IgnoreHitback    = false;
            this.DefaultConstTime = 0;

//            Debug.Log("TestPerson_PrefabPath:"+ prefabPath);
            this.obj = MemoryMgr.InstantiateGameObject(prefabPath, pos, Quaternion.identity, parent);


            allSkillNames = skillTypes;
            //初始化技能
            if (skillTypes != null)
            {
                foreach (var str in skillTypes)
                {
                    //skillDic.Add(str, SkillTriggerMgr.skillInstanceDic[str]);
                    skills.Add(SkillTriggerMgr.skillInstanceDic[str]);
                }
            }

            if (skillTypes != null)
            {
                this.maxRealSkillCount = skillTypes.Count - this.BaseSkillCount;
            }
            else
            {
                this.maxRealSkillCount = 0;
            }

            //添加基本攻击效果
            this.OnAttackListRefresh += AddBaseAttackEffects;
            //添加事件监听
            OnAddListener();

            //开始每帧Update
            MainLoop.Instance.AddUpdateFunc(Update);

            //记录每个实例
            instanceList.Add(this);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 创建窗体
        /// </summary>
        /// <returns></returns>
        protected virtual void Create(string path)
        {
            m_sResName = path;

            if (m_TransFrom)
            {
                Debug.LogError("Window Create Error Exist");
                return;
            }

            if (string.IsNullOrEmpty(m_sResName))
            {
                Debug.LogError("Windows Create Error ResName is empty");
                return;
            }

            if (GlobalVar.G_Canvas == null)
            {
                throw new Exception("你忘了初始化GlobalVar.G_Canvas");
            }

            var canvas = GlobalVar.G_Canvas.transform;

            if (null == canvas)
            {
                throw new Exception("画布获取失败");
            }

            var obj = MemoryMgr.InstantiateGameObject(m_sResName, canvas);

            if (obj == null)
            {
                Debug.LogError("Window Create Error LoadRes WindowName = " + m_sResName);
                return;
            }

            m_TransFrom = obj.transform;

            m_TransFrom.gameObject.SetActive(false);

            InitWindow();
        }