コード例 #1
0
//		new void Awake(){
//			mapItemAnimator = GetComponent<Animator> ();
//
//			mapItemRenderer = GetComponent<SpriteRenderer> ();
//
//			bc2d = GetComponent<BoxCollider2D> ();
//			this.range = new Vector2 (10, 10);
//			this.towards = MyTowards.Right;
//			bulletPool = InstancePool.GetOrCreateInstancePool ("BulletPool", CommonData.poolContainerName);
//			SetUpLauncher ();
//		}

        public override void InitMapItem()
        {
            bc2d.enabled = true;
            SetUpLauncher();
            SetSortingOrder(-(int)transform.position.y);
            bulletPool = InstancePool.GetOrCreateInstancePool("BulletPool", CommonData.poolContainerName);
        }
コード例 #2
0
        void Awake()
        {
            Transform poolContainerOfBagCanvas = TransformManager.FindOrCreateTransform(CommonData.poolContainerName + "/PoolContainerOfBagCanvas");

            //创建缓存池
            bagItemsPool = InstancePool.GetOrCreateInstancePool("BagItemsPool", poolContainerOfBagCanvas.name);
        }
コード例 #3
0
        public override void AddToPool(InstancePool pool)
        {
//			attachedItem = null;

            bc2d.enabled = false;

            gameObject.SetActive(false);

            pool.AddInstanceToPool(this.gameObject);
        }
コード例 #4
0
        /// <summary>
        /// 初始化记录页面
        /// </summary>
        /// <param name="learnInfo">Learn info.</param>
        /// <param name="tabIndex">选项卡序号 【0:基本信息 1:错误单词】.</param>
        public void SetUpRecordView(LearningInfo learnInfo)
        {
            this.learnInfo = learnInfo;

            // 创建缓存池
            wordPool = InstancePool.GetOrCreateInstancePool("WordItemPool", CommonData.poolContainerName);

            SetUpGeneralLearningInfo();

            GetComponent <Canvas>().enabled = true;
        }
コード例 #5
0
        public static InstancePool GetOrCreateInstancePool(string poolName, string parentName)
        {
            Transform trans = TransformManager.FindOrCreateTransform(parentName + "/" + poolName);

            InstancePool instancePool = trans.GetComponent <InstancePool> ();

            if (instancePool == null)
            {
                instancePool = trans.gameObject.AddComponent <InstancePool> ();
            }
            return(instancePool);
        }
コード例 #6
0
 public override void AddToPool(InstancePool pool)
 {
     bc2d.enabled = false;
     //DisableAllDetect();
     if (delayMoveCoroutine != null)
     {
         StopCoroutine(delayMoveCoroutine);
     }
     //StopCoroutine("DelayedMovement");
     pool.AddInstanceToPool(this.gameObject);
     StopMoveImmidiately();
     gameObject.SetActive(false);
     pool.AddInstanceToPool(this.gameObject);
 }
コード例 #7
0
 /// <summary>
 /// 加入缓存池
 /// </summary>
 /// <param name="pool">Pool.</param>
 public override void AddToPool(InstancePool pool)
 {
     StopMoveImmidiately();
     if (delayMoveCoroutine != null)
     {
         StopCoroutine(delayMoveCoroutine);
     }
     DisableAllDetect();
     isReadyToFight = false;
     HideAllAlertAreas();
     bc2d.enabled = false;
     gameObject.SetActive(false);
     pool.AddInstanceToPool(this.gameObject);
 }
コード例 #8
0
        public void InitLearnView(int totalWordsCount)
        {
            crystalHarvestCount.text = "0";

            UpdateLearningProgress(0, totalWordsCount, false);

            totalTurnCount = 0;

            isShowRightAnswerFinished = true;

            crystalPool = InstancePool.GetOrCreateInstancePool("CrystalPool", CommonData.poolContainerName);

            SetUpBasicInformation();
        }
コード例 #9
0
        public void AddToPool(InstancePool pool)
        {
            this.boxCollider.enabled = false;

            this.gameObject.SetActive(false);

            int posX = Mathf.RoundToInt(oriPos.x);
            int posY = Mathf.RoundToInt(oriPos.y);

            ExploreManager.Instance.newMapGenerator.mapWalkableInfoArray[posX, posY] = 1;

            characterSmallDetect.SetBoxColliderEnable(false);

            pool.AddInstanceToPool(this.gameObject);
        }
コード例 #10
0
        public void InitVerticalScrollViewData(List <object> dataList, InstancePool cellPool, Transform cellModel)
        {
            this.allDataList = dataList;
            this.cellPool    = cellPool;
            this.cellModel   = cellModel;

            totalModelCount = dataList.Count;

            scrollViewPortHeight = (transform as RectTransform).rect.height;

            cellHeight = (cellModel as RectTransform).rect.height;

            VerticalLayoutGroup layout = scrollContentContainer.GetComponent <VerticalLayoutGroup> ();

            paddingY = layout.spacing;

            topOffsetY = layout.padding.top;

//			bottomOffsetY = layout.padding.bottom;

            maxCellsVisible = (int)(scrollViewPortHeight / (cellHeight + paddingY) + 2);
        }
コード例 #11
0
 void Awake()
 {
     this.choiceButtonPool = InstancePool.GetOrCreateInstancePool("NPCChoiceButtonPool", CommonData.exploreScenePoolContainerName);
     this.goodsPool        = InstancePool.GetOrCreateInstancePool("NPCGoodsPool", CommonData.exploreScenePoolContainerName);
 }
コード例 #12
0
 public void InitExploreAgentView()
 {
     statusTintPool = InstancePool.GetOrCreateInstancePool("StatusTintPool", CommonData.exploreScenePoolContainerName);
     fightTextPool  = InstancePool.GetOrCreateInstancePool("FightTextPool", CommonData.exploreScenePoolContainerName);
     fightTextManager.InitFightTextManager(fightTextPool, fightTextModel, fightTextContainer);
 }
コード例 #13
0
 public override void AddToPool(InstancePool pool)
 {
     pool.AddInstanceToPool(this.gameObject);
 }
コード例 #14
0
        /// <summary>
        /// 在地图上生成奖励物品
        /// </summary>
        /// <param name="reward">Reward.</param>
        /// <param name="rewardPosition">Reward position.</param>
        /// <param name="rewardPool">Reward pool.</param>
        public void SetUpRewardInMap(Item reward, Vector3 rewardPosition, InstancePool rewardPool)
        {
            this.reward = reward;

            this.rewardPool = rewardPool;

            sr.sprite = GameManager.Instance.gameDataCenter.GetGameItemSprite(reward);

            transform.position    = new Vector3(rewardPosition.x, rewardPosition.y, rewardPosition.z);
            sr.transform.position = new Vector3(rewardPosition.x, rewardPosition.y + 0.5f, rewardPosition.z);

            sr.sortingOrder = -Mathf.RoundToInt(rewardPosition.y);

            gameObject.SetActive(true);

            // 检查人物背包是否已经满了
            bool bagFull = Player.mainPlayer.CheckBagFull(reward);

            bool npcCanvasOnTop = false;

            Canvas npcCanvas = TransformManager.FindTransform("NPCCanvas").GetComponent <Canvas>();

            npcCanvasOnTop = npcCanvas.enabled;

            // 背包满了
            if (bagFull)
            {
                // 提示背包已满
                if (npcCanvasOnTop)
                {
                    npcCanvas.GetComponent <NPCViewController>().tintHUD.SetUpSingleTextTintHUD("背包已满");
                }
                else
                {
                    ExploreManager.Instance.expUICtr.SetUpSingleTextTintHUD("背包已满");
                }

                bc2d.enabled = true;
                // 奖励物品在地图上漂浮
                if (rewardFloatCoroutine != null)
                {
                    StopCoroutine(rewardFloatCoroutine);
                }
                rewardFloatCoroutine = RewardFloat();
                StartCoroutine(rewardFloatCoroutine);
                ExploreManager.Instance.newMapGenerator.mapWalkableInfoArray[Mathf.RoundToInt(rewardPosition.x), Mathf.RoundToInt(rewardPosition.y)] = 2;
            }
            else
            {
                // 玩家获得物品
                if (!npcCanvasOnTop)
                {
                    ExploreManager.Instance.ObtainReward(reward);
                }

                bc2d.enabled = false;

                // 物品飞向玩家
                RewardFlyToPlayer(delegate
                {
                    AddToPool(rewardPool);
                    ExploreManager.Instance.expUICtr.UpdateBottomBar();
                }, true);
            }
        }
コード例 #15
0
 public void SetPool(InstancePool pool)
 {
     this.characterFragmentPool = pool;
 }
コード例 #16
0
        //private InstancePool wordPool;

        public void InitWordItemView(CallBackWithWord changeStatusButtonClickCallBack, CallBack showWordDetailCallBack, InstancePool wordPool)
        {
            this.changeStatusButtonClickCallBack = changeStatusButtonClickCallBack;
            this.showWordDetailCallBack          = showWordDetailCallBack;
            //this.wordPool = wordPool;
        }
コード例 #17
0
        public void BulletMove(Vector3 launcherPos, MyTowards towards, Vector2 range, InstancePool bulletPool)
        {
            this.bulletPool = bulletPool;

            Vector3 bulletLaunchPos = Vector3.zero;

            switch (towards)
            {
            case MyTowards.Left:
                bulletLaunchPos = launcherPos + new Vector3(-0.5f, 0, 0);
                break;

            case MyTowards.Right:
                bulletLaunchPos = launcherPos + new Vector3(0.5f, 0, 0);
                break;

            case MyTowards.Up:
                bulletLaunchPos = launcherPos + new Vector3(0, 0.5f, 0);
                break;

            case MyTowards.Down:
                bulletLaunchPos = launcherPos + new Vector3(0, -0.5f, 0);
                break;
            }

            this.transform.position = bulletLaunchPos;

            bc2d.enabled = true;

            bulletMoveCoroutine = BulletMoveWithMoveVectorAndRange(towards, range);

            StartCoroutine(bulletMoveCoroutine);
        }
コード例 #18
0
 public void InitCharactersInBagHUD()
 {
     characterPool = InstancePool.GetOrCreateInstancePool("CharacterPool", CommonData.poolContainerName);
 }
コード例 #19
0
 void Awake()
 {
     consumablesButtonPool = InstancePool.GetOrCreateInstancePool("ConsumablesButtonPool", CommonData.exploreScenePoolContainerName);
 }
コード例 #20
0
 public void AddToPool(InstancePool pool)
 {
     boxCollider.enabled = false;
     gameObject.SetActive(false);
     pool.AddInstanceToPool(this.gameObject);
 }
コード例 #21
0
 public void InitUnlockedItemView()
 {
     unlockedItemsPool = InstancePool.GetOrCreateInstancePool("UnlockedItemPool", CommonData.poolContainerName);
 }
コード例 #22
0
 /// <summary>
 /// 初始化文本动画控制器
 /// </summary>
 /// <param name="exploreTextPool">Explore text pool.</param>
 /// <param name="exploreTextModel">Explore text model.</param>
 /// <param name="exploreTextContainer">Explore text container.</param>
 public void InitExploreTextManager(InstancePool exploreTextPool, Transform exploreTextModel, Transform exploreTextContainer)
 {
     this.exploreTextPool      = exploreTextPool;
     this.exploreTextModel     = exploreTextModel;
     this.exploreTextContainer = exploreTextContainer;
 }
コード例 #23
0
 /// <summary>
 /// 加入缓存池
 /// </summary>
 /// <param name="pool">Pool.</param>
 public abstract void AddToPool(InstancePool pool);
コード例 #24
0
 public void InitFightTextManager(InstancePool fightTextPool, Transform fightTextModel, Transform fightTextContainer)
 {
     this.fightTextPool      = fightTextPool;
     this.fightTextModel     = fightTextModel;
     this.fightTextContainer = fightTextContainer;
 }
コード例 #25
0
 void Awake()
 {
     recipesItemPool = InstancePool.GetOrCreateInstancePool("RecipesItemPool", CommonData.bagCanvasPoolContainerName);
 }
コード例 #26
0
ファイル: Door.cs プロジェクト: stephenhou2/InstanceWordGame
 public override void AddToPool(InstancePool pool)
 {
     bc2d.enabled = false;
     pool.AddInstanceToPool(this.gameObject);
 }
コード例 #27
0
 public override void AddToPool(InstancePool pool)
 {
 }