コード例 #1
0
    void Onclick(UnityEngine.InputSystem.InputAction.CallbackContext context)
    {
        Interactable hoverInteract = RaycastManager.instance.GetHoveringObjectInteract();

        if (hoverInteract == null)
        {
            if (holdingFreeObj != null && holdingPlacementGhost.activeSelf)
            {
                tweenObject(holdingFreeObj.gameObject, holdingPlacementGhost.transform.position, Quaternion.identity);
                holdingFreeObj.SetRigidbodyKinematic(false);
                holdingFreeObj.transform.parent = freeObjectParent;
                holdingFreeObj = null;
                Destroy(holdingPlacementGhost);
            }
            return;
        }
        if (hoverInteract.interactType() == Interactable.InteractType.freeObject)
        {
            FreeObj hoverFreeobj = (FreeObj)hoverInteract;
            if (holdingFreeObj != null)
            {
                tweenObject(holdingFreeObj.gameObject, hoverFreeobj.transform.position + new Vector3(0, 0.05f, 0), hoverFreeobj.transform.rotation);
                holdingFreeObj.SetRigidbodyKinematic(false);
                holdingFreeObj.transform.parent = freeObjectParent;
            }
            holdingFreeObj = hoverFreeobj;
            changePlacementGhost(holdingFreeObj.gameObject);
            tweenObject(holdingFreeObj.gameObject, holdTrans);
            holdingFreeObj.SetRigidbodyKinematic(true);
            holdingFreeObj.transform.parent = holdTrans;
        }
    }
コード例 #2
0
        private void InitUI()
        {
            if (campaignId <= 0)
            {
                return;
            }

            mainTpl = Hotfix_LT.Data.SceneTemplateManager.Instance.GetLostMainCampaignTplById(campaignId.ToString());
            if (mainTpl == null)
            {
                return;
            }

            DataLookupsCache.Instance.SearchIntByID(string.Format("userCampaignStatus.normalChapters.{0}.campaigns.{1}.star", mainTpl.ChapterId, campaignId), out m_StarNum);
            DataLookupsCache.Instance.SearchDataByID <bool>(string.Format("userCampaignStatus.normalChapters.{0}.campaigns.{1}.complete", mainTpl.ChapterId, campaignId), out m_IsComplete);

            TitleLabel.text = mainTpl.Name;
            DescLabel.text  = mainTpl.Desc;
            for (int i = 0; i < StarList.Count; i++)
            {
                if (i < m_StarNum)
                {
                    StarList[i].gameObject.CustomSetActive(true);
                }
                else
                {
                    StarList[i].gameObject.CustomSetActive(false);
                }
            }

            isShowFree = Hotfix_LT.Data.NewGameConfigTemplateManager.Instance.GetGameConfigValue("DungeonFirstPassFree") > 0 && m_StarNum <= 0;
            FreeObj.CustomSetActive(isShowFree);
            CostObj.CustomSetActive(!isShowFree);
            VigorCostLabel.text = mainTpl.CostVigor.ToString();

            for (int i = 0; i < DropItemList.Count; i++)
            {
                if (i < mainTpl.AwardIconList.Count)
                {
                    DropItemList[i].mDMono.gameObject.CustomSetActive(true);
                    int    tempID = int.Parse(mainTpl.AwardIconList[i]);
                    string id     = tempID < 1000 ? BalanceResourceUtil.GetResStrID(tempID) : tempID.ToString();
                    string type   = tempID < 1000 ? LTShowItemType.TYPE_RES : LTShowItemType.TYPE_GAMINVENTORY;
                    DropItemList[i].LTItemData = new LTShowItemData(id, 0, type, false);
                }
                else
                {
                    DropItemList[i].mDMono.gameObject.CustomSetActive(false);
                }
            }

            bool isCanBlitz = m_IsComplete && m_StarNum >= 3;

            BlitzLabel.gameObject.CustomSetActive(!isCanBlitz);
            BlitzBtn.gameObject.CustomSetActive(isCanBlitz);
            MultiBlitzBtn.gameObject.CustomSetActive(isCanBlitz);
            BattleBtn.transform.localPosition = isCanBlitz ? RightBattlePos : LeftBattlePos;
            BattleBtn.gameObject.CustomSetActive(true);
        }