Exemple #1
0
 private void InitStyleDict()
 {
     StyleDict = new Dictionary <WeaponHudStyleType, WeaponHudStyle>(CommonIntEnumEqualityComparer <WeaponHudStyleType> .Instance);
     StyleDict.Add(WeaponHudStyleType.Top, new WeaponHudStyle(UiCommonColor.ColorGammaCorrect(0.4f), Vector3.one * 0.7f, 1));
     StyleDict.Add(WeaponHudStyleType.Up, new WeaponHudStyle(UiCommonColor.ColorGammaCorrect(0.7f), Vector3.one * 0.85f, 2));
     StyleDict.Add(WeaponHudStyleType.Center, new WeaponHudStyle(1f, Vector3.one, 3));
     StyleDict.Add(WeaponHudStyleType.Down, new WeaponHudStyle(UiCommonColor.ColorGammaCorrect(0.7f), Vector3.one * 0.85f, 4));
     StyleDict.Add(WeaponHudStyleType.Bottom, new WeaponHudStyle(UiCommonColor.ColorGammaCorrect(0.4f), Vector3.one * 0.7f, 5));
 }
        private Color GetChannelColor(BroadcastMessageData data)
        {
            if (IsFromSystem(data))
            {
                return(UiCommonColor.SystemMessageColor);
            }
            var channel = ChatTypeToChannel((ChatType)data.ChatType);

            return(UiCommonColor.GetChatColorByChatChannel(channel));
        }
 private void UpdateChannel()
 {
     _viewModel.ChannelTipText  = GetChannelChannelTip(_curChannel);
     _viewModel.ChannelTipColor = UiCommonColor.GetChatColorByChatChannel(_curChannel);
     if (inputField == null || inputField.textComponent == null)
     {
         Logger.Error("can't found text in inputfield");
         return;
     }
     inputField.textComponent.color = _curChannel == ChatChannel.PrivateChat
         ? UiCommonColor.GetChatColorByChatChannel(ChatChannel.PrivateChat)
         : Color.white;
 }
Exemple #4
0
        // PartPosData partPosData;

        protected override void SetView()
        {
            var partPosData = Data as TipPartUiData;

            viewModel.PartName      = TipConst.GetWeaponPartTypeName((EWeaponPartType)partPosData.Type);
            viewModel.PartNameColor = UiCommonColor.GetQualityColor(partPosData.Quality);
            var assetIconInfo = AssetBundleConstant.GetPartsQualityAssetInfo(partPosData.Quality);

            Loader.RetriveSpriteAsync(assetIconInfo.BundleName, assetIconInfo.AssetName, (sprite) => viewModel.PartQualitySprite = sprite);

            if (!partPosData.HaveWeaponPart())
            {
                viewModel.PartsText  = "未装备";
                viewModel.PartsColor = UiCommonColor.GetQualityColor(0);
            }
            else
            {
                viewModel.PartsText  = partPosData.Name;
                viewModel.PartsColor = UiCommonColor.GetQualityColor(partPosData.Quality);
            }
        }
        public void AddMessage(BroadcastMessageData data)
        {
            var tf                   = GetNewMessageItem();
            var channelColor         = GetChannelColor(data);
            var channelName          = GetChannelNamePrefix(data, channelColor);
            var messageText          = string.Empty;
            var textComponent        = tf.GetComponent <Text>();
            var channelRoot          = textComponent.transform.GetChild(0);
            var channelTextComponent = channelRoot != null?channelRoot.GetComponent <Text>() : null;

            if (tf != null && data != null && data.ChatMessage != null)
            {
                if (TargetIdDict != null)
                {
                    if (!TargetIdDict.ContainsKey(data.SendRoleId))
                    {
                        TargetIdDict[data.SendRoleId] = string.Empty;
                    }

                    TargetIdDict[data.SendRoleId] = data.SendRoleName;
                }

                if (IsFromSystem(data))
                {
                    var color = ColorUtility.ToHtmlStringRGB(UiCommonColor.SystemMessageColor);
                    messageText = string.Format(commonMessageWithColorFormat, color, data.ChatMessage.Message);
                }
                else if (data.ChatType == (int)ChatType.PrivateChat)
                {
                    var color = ColorUtility.ToHtmlStringRGB(
                        UiCommonColor.GetChatColorByChatChannel(ChatChannel.PrivateChat));
                    messageText = string.Format(commonMessageWithColorFormat, color, messageText);
                    long privateChatId = 0;
                    if (data.SendRoleId == _chatState.MyselfId)
                    {
                        privateChatId = data.TargetId;
                        messageText   = string.Format(ScriptLocalization.hall_chat.word231,
                                                      TargetIdDict[privateChatId]) + data.ChatMessage.Message;
                    }
                    else
                    {
                        privateChatId = data.SendRoleId;
                        var name = string.Format(ScriptLocalization.hall_chat.PlayerNameFormat, data.SendRoleName);
                        messageText = name + data.ChatMessage.Message;
                    }

                    PrivateChatRecentUseQueueUpdate(privateChatId);
                    messageText = string.Format(commonMessageWithColorFormat, color, messageText);

                    if (ChatListState != EUIChatListState.Send)
                    {
                        _curChannel = ChatChannel.PrivateChat;
                        SetPrivateTarget(privateChatId);
                        UpdateChannel();
                    }
                }
                else
                {
                    var color = ColorUtility.ToHtmlStringRGB(UiCommonColor.ChatSenderColor);
                    var name  = string.Format(ScriptLocalization.hall_chat.PlayerNameFormat, data.SendRoleName);
                    messageText = string.Format(commonMessageWithColorFormat, color, name) +
                                  data.ChatMessage.Message;
                }

                if (channelTextComponent != null)
                {
                    channelTextComponent.text = channelName;
                }
                textComponent.text = messageText;
            }
            else
            {
                Logger.Error("Null object,can't addMessage");
            }

            if (ChatListState == EUIChatListState.None)
            {
                ChatListState = EUIChatListState.Receive;
            }
            ResetTime();
            //_closeViewAnim.Rewind();
        }
Exemple #6
0
        public void AddMessage(BroadcastMessageData data)
        {
            var tf = GetNewMessageItem();

            if (tf != null && data != null && data.ChatMessage != null)
            {
                if (TargetIdDict != null)
                {
                    if (!TargetIdDict.ContainsKey(data.SendRoleId))
                    {
                        TargetIdDict[data.SendRoleId] = string.Empty;
                    }
                    TargetIdDict[data.SendRoleId] = data.SendRoleName;
                }

                if (data.SendRoleId == 0)
                {
                    tf.GetComponent <Text>().text = data.ChatMessage.Message;
                }
                else
                {
                    tf.GetComponent <Text>().text = data.SendRoleName + ":" + data.ChatMessage.Message;
                }
                if (data.ChatType == (int)ChatType.PrivateChat)
                {
                    long privateChatId = 0;
                    if (data.SendRoleId == _chatState.MyselfId)
                    {
                        privateChatId = data.TargetId;
                        tf.GetComponent <Text>().text = string.Format(ScriptLocalization.hall_chat.word231,
                                                                      TargetIdDict[privateChatId]) + data.ChatMessage.Message;
                        PrivateChatRecentUseQueueUpdate(privateChatId);
                    }
                    else
                    {
                        privateChatId = data.SendRoleId;
                        PrivateChatRecentUseQueueUpdate(privateChatId);
                    }
                    if (ChatListState != EUIChatListState.Send)
                    {
                        _curChannel = ChatChannel.PrivateChat;
                        SetPrivateTarget(privateChatId);
                        UpdateChannel();
                    }
                }

                if (data.SendRoleId > 0)
                {
                    tf.GetComponent <Text>().color = UiCommonColor.GetChatChannelColor(ChatTypeToChannel((ChatType)data.ChatType));
                }
                else
                {
                    tf.GetComponent <Text>().color = Color.red;
                }
            }
            else
            {
                Logger.Error("Null object,can't addMessage");
            }
            ResetTime();
            _closeViewAnim.Rewind();
            if (messageDict != null)
            {
                if (ChatListState == EUIChatListState.None)
                {
                    ChatListState = EUIChatListState.Receive;
                }
                messageDict.Add(tf, data);
            }
        }
Exemple #7
0
 private void UpdateChannel()
 {
     _viewModel.ChannelTipText  = GetChannelChannelTip(_curChannel);
     _viewModel.ChannelTipColor = UiCommonColor.GetChatChannelColor(_curChannel);
 }