/// <summary> /// 現在も押下状態であるかの判定を返す /// </summary> public bool CheckPressedStill(LongPressButton button) { pressedButton = button; if (isDrag) { return(true); } return(false); }
public override void OnEndDrag(PointerEventData eventData) { base.OnEndDrag(eventData); // 削除した場合、挙動に影響有り isDrag = false; if (pressedButton) { pressedButton.EndPress(); } pressedButton = null; }
private void Awake() { _onClick = transform.Find("OnClick").gameObject; _bottomBg = transform.Find("GiftContent"); _bottomBg.GetRectTransform().GetWorldCorners(_contentV3); _getDesc = _bottomBg.Find("HintText").gameObject; _giftParent = _bottomBg.Find("GiveGiftsList/Content"); _giveGiftsBtn = _bottomBg.GetButton("GiveGiftsBtn"); _giveGiftsLongPressBtn = _giveGiftsBtn.gameObject.GetComponent <LongPressButton>(); _itemDesc = _bottomBg.Find("HintContent/Hint").gameObject; _maxLevel = GlobalData.FavorabilityMainModel.GetLatsFavorabilityLevelRulePB().Level; _giveGiftsLongPressBtn.OnDown = OnDown; _giveGiftsLongPressBtn.OnUp = OnUp; SteOnClikcHideHint(); }
private void Awake() { _title = transform.GetText("window/TitleText"); _desc = transform.GetText("window/Desc"); _frame = transform.Find("window/ItemContent/SmallFrame").GetComponent <Frame>(); _num = transform.GetText("window/ItemContent/ItemNum"); _reduceBtn = transform.Find("window/ReduceBtn").GetComponent <LongPressButton>(); _addBtn = transform.Find("window/AddBtn").GetComponent <LongPressButton>(); _curNum = transform.GetText("window/CurNum"); _price = transform.GetText("window/Content"); _exchangeIcon = transform.GetRawImage("window/Content/Image"); _remainBuyNum = transform.GetText("window/BuyCount"); _buyBtn = transform.GetButton("window/BuyBtn"); _buyBtn.onClick.AddListener(OnClickBuyBtn); SetAddBtn(); SetReduceBtn(); }
private void Awake() { itemName = transform.Find("window/TitleText").GetText(); _haveNumText = transform.Find("window/CurNum").GetText(); _itemNumText = transform.Find("window/FrameImage/ItemNum").GetText(); _costNum = transform.Find("window/Content").GetText(); _itemRawIamge = transform.Find("window/FrameImage/ItemRawImage").GetRawImage(); _costIconRawIamge = transform.Find("window/Content/Image").GetRawImage(); _buyBtn = transform.Find("window/BuyBtn").GetButton(); _buytext = transform.Find("window/BuyBtn/Text").GetText(); _addLongPressBtn = transform.Find("window/AddBtn").GetComponent <LongPressButton>(); _reduceLongPressBtn = transform.Find("window/ReduceBtn").GetComponent <LongPressButton>(); _malldesc = transform.Find("window/Desc").GetText(); _buyBtn.onClick.AddListener(BuyGoodClick); _buyCountDesc = transform.Find("window/BuyCount").GetText(); _addLongPressBtn.OnDown = () => { if (_curnum >= leftTime) //要减去已经购买的次数 { return; } _curnum++; // Debug.LogError(_curnum); _itemNumText.text = _curnum.ToString(); //到底要更新谁的显示? _costNum.text = I18NManager.Get("Shop_CostToBuy", _curnum * realprice); //$"是否花费 {_curnum*realprice} 购买"; }; _reduceLongPressBtn.OnDown = () => { if (_curnum <= 1) { return; } _curnum--; _itemNumText.text = _curnum.ToString(); //到底要更新谁的显示? // Debug.LogError(_curnum); _costNum.text = I18NManager.Get("Shop_CostToBuy", _curnum * realprice); }; }
private void InitComponent() { chatTop = transform.Find("ChatTop"); chatBottom = transform.Find("ChatBottom"); chatMain = transform.Find("ChatMain"); chatMiddle = transform.Find("ChatMiddle"); worldChat = chatMain.Find("WorldChat"); privateChat = chatMain.Find("PrivateChat"); privateChatBg = chatMain.Find("PrivateChat/PrivateChatTop/BackGroundImage"); labourUnionChat = chatMain.Find("LabourUnionChat"); playerInfo = privateChat.Find("ChatPlayerInfo"); hornPanel = chatMiddle.Find("HornPanel").GetComponent <HornPanel>(); hornPanel.sendHornMessageOnClick = OnClickSendHornMessageCallBack; playerInfoPanel = chatMiddle.Find("PlayerInfoPanel"); shieldPlayerPanel = chatMiddle.Find("ShieldPlayerPanel"); addFriendPanel = chatMiddle.Find("AddFriendPanel"); expressionPanel = chatMiddle.Find("ExpressionPanel"); hornNumberText = chatBottom.Find("HornNumberText").GetComponent <Text> (); sendText = chatBottom.Find("SendText").GetComponent <Text> (); worldText = chatTop.transform.Find("WorldToggle/WorldText").GetComponent <Text> (); worldText.color = Color.white; privateChatText = chatTop.transform.Find("PrivateChatToggle/PrivateChatText").GetComponent <Text> (); privateChatText.color = Color.gray; labourUnionText = chatTop.transform.Find("LabourUnionToggle/LabourUnionText").GetComponent <Text> (); labourUnionText.color = Color.gray; //BuyHornPanel buyHornPanel = chatMiddle.Find("BuyHornPanel"); buyHornContentText = buyHornPanel.Find("ContentText").GetComponent <Text> (); buyHornButton = buyHornPanel.Find("EnterButton").GetComponent <Button> (); buyHornCanelButton = buyHornPanel.Find("CancelButton").GetComponent <Button> (); //BuyDiamondPanel buyDiamondPanel = chatMiddle.Find("BuyDiamondPanel"); buyDiamondButton = buyDiamondPanel.Find("EnterButton").GetComponent <Button> (); buyDiamondCanelButton = buyDiamondPanel.Find("CancelButton").GetComponent <Button> (); //VoiceTipPanel recordingTipPanel = chatMiddle.Find("RecordingTipPanel"); tipText = recordingTipPanel.Find("TipText").GetComponent <Text> (); //PlayerInfoPanel addFriendButton = playerInfoPanel.Find("AddFriendButton").GetComponent <Button> (); lookFriendButton = playerInfoPanel.Find("LookFriendButton").GetComponent <Button> (); shieldFriendButton = playerInfoPanel.Find("ShieldFriendButton").GetComponent <Button> (); playerInfoPanelMaskButton = playerInfoPanel.Find("MaskButton").GetComponent <Button> (); InfoPanelPlayerNameText = playerInfoPanel.Find("PlayerNameText").GetComponent <Text> (); InfoPanelPlayerLevelText = playerInfoPanel.Find("PlayerLevelText").GetComponent <Text> (); InfoPanelPlayerDanText = playerInfoPanel.Find("PlayerDanText").GetComponent <Text> (); //AddFriendPanel addFriendPanelEnterButton = addFriendPanel.Find("EnterButton").GetComponent <Button> (); addFriendPanelCancelButton = addFriendPanel.Find("CancelButton").GetComponent <Button> (); addFriendPanelCountText = addFriendPanel.Find("PlayerIcon/AddPlayerText").GetComponent <Text> (); //ShieldPlayerPanel shieldPlayerPanelEnterButton = shieldPlayerPanel.Find("EnterButton").GetComponent <Button> (); shieldPlayerPanelCancelButton = shieldPlayerPanel.Find("CancelButton").GetComponent <Button> (); shieldPlayerPanelCountText = shieldPlayerPanel.Find("ShieldPlayerTextTitle/ShieldPlayerText").GetComponent <Text> (); voiceToggle = chatBottom.Find("VoiceToggle").GetComponent <Toggle> (); sendMessageInputField = chatBottom.Find("SendMessageInputField").GetComponent <InputField> (); speakButton = chatBottom.Find("SpeakButton").GetComponent <LongPressButton> (); speakButton.pressDownEvent = BeginRecord; speakButton.longPressEvent = Recording; speakButton.leaveEvent = PauseRecord; speakButton.EnterEvent = ResumeRecord; speakButton.pressUpEvent = BreakOffRecord; exitButton = transform.Find("MaskButton").GetComponent <Button> (); hornButton = chatBottom.Find("HornButton").GetComponent <Button> (); expressionButton = chatBottom.Find("ExpressionButton").GetComponent <Button> (); sendButton = chatBottom.Find("SendButton").GetComponent <Button> (); expressionMaskButton = expressionPanel.Find("ExpressionMaskButton").GetComponent <Button> (); myFriendScrollView = privateChat.Find("MyFriendScrollView").GetComponent <MyFriendScrollView>(); myFriendScrollView.OnCreateItemHandler = OnCreateFriendtem; myFriendScrollRect = myFriendScrollView.GetComponent <ScrollRect> (); myFriendGroup = privateChat.Find("MyFriendScrollView/ViewPort/PlayerInfoGroup").GetComponent <ToggleGroup> (); friendNumberInfoText = privateChat.Find("PrivateChatTop/FriendNumberText").GetComponent <Text>(); friendNameText = privateChat.Find("PrivateChatTop/FriendNameText").GetComponent <Text>(); chatScrollView = chatMain.Find("ChatScrollView").GetComponent <ChatScrollView> (); chatScrollView.OnCreateItemHandler = OnCreateItem; chatScrollRect = chatScrollView.GetComponent <ScrollRect> (); //show Broadcast message broadcastPanel = chatScrollView.transform.Find("BroadcastPanel"); playerLevelText = broadcastPanel.transform.Find("PlayerLevelText").GetComponent <Text>(); playerNameText = broadcastPanel.transform.Find("PlayerNameText").GetComponent <Text>(); playerIcon = broadcastPanel.transform.Find("PlayerIcon").GetComponent <Image>(); messageText = broadcastPanel.transform.Find("MessageText").GetComponent <InlineText>(); privateChatScrollView = privateChat.Find("PrivateChatScrollView").GetComponent <PrivateChatScrollView> (); privateChatScrollView.OnCreateItemHandler = OnCreatePrivateChatItem; privateChatScrollRect = privateChatScrollView.GetComponent <ScrollRect> (); }