Пример #1
0
    public MinesPage(AlmanacMenu menu, ModEntry mod) : base(menu, mod)
    {
        Seed = Mod.GetBaseWorldSeed();

        Sprites = new();

        Sprites[LevelType.Mushroom] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(O)420", 1)             // Red Mushroom
            );

        Sprites[LevelType.InfestedMonster] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(W)0", 1)             // Rusty Sword
            );

        Sprites[LevelType.InfestedSlime] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(O)766", 1)             // Slime
            );

        Sprites[LevelType.Quarry] = new SpriteInfo(
            Mod.Helper.GameContent.Load <Texture2D>("Characters/Monsters/Haunted Skull"),
            new Rectangle(0, 0, 16, 16)
            );

        Sprites[LevelType.InfestedQuarry] = new SpriteInfo(
            Mod.Helper.GameContent.Load <Texture2D>("Characters/Monsters/Haunted Skull"),
            new Rectangle(0, 0, 16, 16)
            );

        Sprites[LevelType.Dino] = SpriteHelper.GetSprite(
            InventoryHelper.CreateItemById("(O)107", 1)             // Dino Egg
            );

        Update();
    }
Пример #2
0
 /// <summary>
 /// 设置我自己 的数据显示
 /// </summary>
 /// <param name="level"></param>
 /// <param name="data"></param>
 /// <param name="type"></param>
 private void SetMyUIData(int level, UserInfo data, int type)
 {
     MeNameText.text    = data.Nickname;
     MeHeadImage.sprite = SpriteHelper.GetPlayerHeadSpriteName(data.HeadId);
     if (level < 4)
     {
         MeRankNumberText.text = "";
         RankLevelImg.gameObject.SetActive(true);
         RankLevelImg.sprite = SpriteHelper.GetSprite("rankatlas", $"rank2_{level}");
         RankLevelImg.SetNativeSize();
     }
     else
     {
         MeRankNumberText.gameObject.SetActive(true);
         MeRankNumberText.text = level.ToString();
     }
     if (type == 1)
     {
         TipsText.text   = "拥有金币";
         MeGoldText.text = GameHelper.ConvertCoinToString(data.Gold);
     }
     else
     {
         TipsText.text   = "今日赢金";
         MeGoldText.text = GameHelper.ConvertCoinToString(data.Score);
     }
 }
Пример #3
0
        /// <summary>
        /// 根据类型显示提示 0:出牌不符合规则  1:没有大过上家的牌 2:出牌不能为空
        /// </summary>
        /// <param name="type"></param>
        public async void Show(int type = 0)
        {
            this.panel.SetActive(true);

            if (type == 0)
            {
                Tip.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_bufuhe");

                Tip.SetNativeSize();

                await Task.Delay(1000);

                this.panel.SetActive(false);
            }
            else if (type == 1)
            {
                Tip.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_meiyoudag");

                Tip.SetNativeSize();

                await Task.Delay(2500);

                this.panel.SetActive(false);
            }
            else if (type == 2)
            {
                Tip.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_OutCardNotEmpty");

                Tip.SetNativeSize();

                await Task.Delay(1000);

                this.panel.SetActive(false);
            }
        }
Пример #4
0
        /// <summary>
        /// 设置玩家头像
        /// </summary>
        /// <param name="vo"></param>
        public void SetPlayerUI(UserVO vo)
        {
            if (vo == null)
            {
                return;
            }

            this.curUseVO = vo;

            this.PlayerHead.sprite = SpriteHelper.GetSprite("ddzgame", this.GetHeadSpriteNameByIndex());

            this.SetHeadTransformByIndex();

            this.PlayerGoldItem.SetActive(true);

            //由于自己位置给的空间比较大,昵称就尽量显示长一些。
            if (seatId != 0)
            {
                this.PlayerName.text = StringHelper.FormatNickName(vo.nickName);
            }
            else
            {
                this.PlayerName.text = StringHelper.FormatNickName(vo.nickName, 20);
            }

            this.PlayerGold.text = NumberHelper.FormatMoney(vo.gold);

            this.PlayerHead.gameObject.SetActive(true);

            //this.LandlordFlag.SetActive(vo.IsLord == 1);

            this.Panel.SetActive(true);

            this.PlayerHead.SetNativeSize();
        }
Пример #5
0
        /// <summary>
        /// 设置数据   type 1-金币,2-收益
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="level"></param>
        /// <param name="info"></param>
        /// <param name="type"></param>
        public void SetRankItemData(Transform parent, int level, UserInfo info, int type)
        {
            this.GameObject.transform.SetParent(parent);
            this.GameObject.transform.localScale = Vector3.one;
            if (level < 4)
            {
                RankLevelImg.gameObject.SetActive(true);
                RankLevelImg.sprite = SpriteHelper.GetSprite("rankatlas", $"rank2_{level}");
                RankLevelImg.SetNativeSize();
            }
            else
            {
                RankLevelImg.gameObject.SetActive(false);
            }
            RankLevelTxt.text = level > 3 ? level.ToString() : "";

            PlayerNameTxt.text = info.Nickname;
            PortraitImg.sprite = SpriteHelper.GetPlayerHeadSpriteName(info.HeadId);
            if (type == 1)
            {
                TipsText.text  = "拥有金币";
                ProfitTxt.text = GameHelper.ConvertCoinToString(info.Gold);
            }
            else
            {
                TipsText.text  = "今日赢金";
                ProfitTxt.text = GameHelper.ConvertCoinToString(info.Score);
            }
            IsMeObj.SetActive(info.PlayerId == UserDataHelper.UserInfo.PlayerId);
            BgImage.enabled = info.PlayerId != UserDataHelper.UserInfo.PlayerId;
        }
Пример #6
0
        /// <summary>
        /// 今日盈利按钮
        /// </summary>
        private async void OnClickProfitBtn()
        {
            SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);
            TableBtn.SetActive(false);
            RankLevelImg.gameObject.SetActive(false);
            RecyleRankItem();
            bool isMe = false;
            await Task.Delay(1);

            if (_resp != null)
            {
                _NoData.SetActive(_resp.IncomeList.Count == 0);
                for (int i = 0; i < _resp.IncomeList.Count; i++)
                {
                    CreateRrankListsItem(_resp.IncomeList[i], 2);
                    if (_resp.IncomeList[i].PlayerId == UserDataHelper.UserInfo.PlayerId)
                    {
                        SetMyUIData(i + 1, _resp.IncomeList[i], 2);
                        isMe = true;
                    }
                }
            }
            if (!isMe)
            {
                MeRankNumberText.text = "";
                RankLevelImg.gameObject.SetActive(true);
                RankLevelImg.sprite = SpriteHelper.GetSprite("rankatlas", $"rank2_weishangbang");
                RankLevelImg.SetNativeSize();
                MeNameText.text    = UserDataHelper.UserInfo.Nickname;
                MeGoldText.text    = "0";
                TipsText.text      = "今日赢金";
                MeHeadImage.sprite = SpriteHelper.GetPlayerHeadSpriteName(UserDataHelper.UserInfo.HeadId);
            }
        }
Пример #7
0
        public void Draw(SpriteBatch batch, Vector2 position, Vector2 size, Vector2 containerSize, float alpha, SpriteFont defaultFont)
        {
            float itemSize = 16 * Scale;

            // Draw Object
            float offsetY = (size.Y - itemSize) / 2;

            if (Value != null)
            {
                Vector2 pos = new(position.X, position.Y + offsetY);
                if (SpriteHelper.GetSprite(Value, Helper) is SpriteInfo sprite)
                {
                    sprite.Draw(batch, pos, Scale);
                }
                else
                {
                    // Fallback. This is basically guaranteed to be
                    // inaccurate, but we don't care.
                    Value.drawInMenu(
                        batch,
                        location: pos,
                        scaleSize: Scale / 4f,
                        transparency: alpha,
                        layerDepth: 0.865f,
                        drawStackNumber: StackDrawType.Hide,
                        color: Color.White,
                        drawShadow: false
                        );
                }
            }

            // Draw Label
            if (DrawLabel)
            {
                string  name      = Value?.DisplayName ?? "???";
                Vector2 labelSize = Game1.smallFont.MeasureString(name);
                Utility.drawTextWithShadow(
                    batch,
                    name,
                    Game1.smallFont,
                    new Vector2(
                        position.X + itemSize + (4 * Scale),
                        position.Y + ((size.Y - labelSize.Y) / 2)
                        ),
                    Game1.textColor * alpha
                    );
            }

            // Draw Quantity
            if (DrawQuantity && Value != null && Value.Stack > 1)
            {
                float qScale = (float)Math.Round(Scale * 0.75f);
                float qX     = itemSize - Utility.getWidthOfTinyDigitString(Value.Stack, qScale) + qScale;
                float qY     = itemSize - 6f * qScale + 2f + offsetY;

                Utility.drawTinyDigits(Value.Stack, batch, new Vector2(position.X + qX, position.Y + qY), qScale, 1f, Color.White * alpha);
            }
        }
Пример #8
0
        public override void Init()
        {
            base.Init();

            _soundSlider = ReferenceCollector.Get <GameObject>("SoundSlider").GetComponent <Slider>();
            _musicSlider = ReferenceCollector.Get <GameObject>("MusicSlider").GetComponent <Slider>();

            SoundIcon = ReferenceCollector.Get <GameObject>("SoundIcon").GetComponent <Image>();
            MusicIcon = ReferenceCollector.Get <GameObject>("MusicIcon").GetComponent <Image>();

            SoundIconOpen = SpriteHelper.GetSprite("commonui", "Common_yinl");

            SoundIconClose = SpriteHelper.GetSprite("commonui", "Common_yinl0");

            MusicIconOpen = SpriteHelper.GetSprite("commonui", "Common_yiny");

            MusicIconClose = SpriteHelper.GetSprite("commonui", "Common_yiny0");

            _musicSlider.value = SoundComponent.Instance.SoundVolume;
            _soundSlider.value = SoundComponent.Instance.SfxVolume;
            this.UpdateIcon();

            _soundSlider.onValueChanged.Add((value) =>
            {
                SoundComponent.Instance.SfxVolume = value;

                this.UpdateIcon();
            });

            _musicSlider.onValueChanged.Add((value) =>
            {
                SoundComponent.Instance.SoundVolume = value;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(ReferenceCollector, "SoundIcon", () =>
            {
                SoundComponent.Instance.SfxVolume = this.SoundIcon.sprite == SoundIconOpen ? 0 : 1;

                _soundSlider.value = SoundComponent.Instance.SfxVolume;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(ReferenceCollector, "MusicIcon", () =>
            {
                SoundComponent.Instance.SoundVolume = this.MusicIcon.sprite == MusicIconOpen ? 0 : 1;

                _musicSlider.value = SoundComponent.Instance.SoundVolume;

                this.UpdateIcon();
            });

            ReferenceCollector.Get <GameObject>("LogOutBtn").GetComponent <Button>().onClick.AddListener(Logout);
        }
Пример #9
0
        /// <summary>
        /// 加载精灵序列
        /// </summary>
        /// <returns></returns>
        public Sprite[] LoadSpriteSheets(string atlasName, string spriteName, int spriteCount)
        {
            List <Sprite> loadList = new List <Sprite>();

            for (int i = 0; i < spriteCount; i++)
            {
                var sprite = SpriteHelper.GetSprite(atlasName, string.Format("{0}{1}", spriteName, i));

                loadList.Add(sprite);
            }

            return(loadList.ToArray());
        }
Пример #10
0
        public void SetPlayerLordIcon(bool isLord = false)
        {
            this.curUseVO.IsLord = isLord ? 1:0;

            this.PlayerHead.sprite = SpriteHelper.GetSprite("ddzgame", this.GetHeadSpriteNameByIndex());

            this.SetHeadTransformByIndex();

            //播放变身特效

            if (isLord)
            {
                this.PlayChangeJieSeFx();
            }
        }
Пример #11
0
        public void AddCrop(
            IManifest manifest,

            string id,

            Item item,
            string name,

            int regrow,
            bool isGiantCrop,
            bool isPaddyCrop,
            bool isTrellisCrop,

            Item[] seeds,

            WorldDate start,
            WorldDate end,

            Tuple <Texture2D, Rectangle?, Color?, Texture2D, Rectangle?, Color?> sprite,
            Tuple <Texture2D, Rectangle?, Color?, Texture2D, Rectangle?, Color?> giantSprite,

            IReadOnlyCollection <int> phases,
            IReadOnlyCollection <Tuple <Texture2D, Rectangle?, Color?, Texture2D, Rectangle?, Color?> > phaseSprites
            )
        {
            var provider = Mod.Crops.GetModProvider(manifest);

            provider !.AddCrop(
                id: id,
                item: item,
                name: name,
                sprite: sprite == null ? (item == null ? null : SpriteHelper.GetSprite(item)) : HydrateSprite(sprite),
                isTrellisCrop: isTrellisCrop,
                isGiantCrop: isGiantCrop,
                giantSprite: HydrateSprite(giantSprite),
                seeds: seeds,
                isPaddyCrop: isPaddyCrop,
                phases: phases,
                phaseSprites: HydrateSprites(phaseSprites),
                regrow: regrow,
                start: start,
                end: end
                );
        }
Пример #12
0
        /// <summary>
        /// 显示操作提示
        /// </summary>
        /// <param name="_index">位置ID</param>
        /// <param name="opType">操作类型0:要不起 </param>
        public async void ShowOpTipById(int _index, int opType, bool destroy = false)
        {
            var tip = _rf.Get <GameObject>("Op" + _index).GetComponent <Image>();

            tip.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_buchupai");

            tip.gameObject.SetActive(true);

            tip.gameObject.name = "buchu";

            tip.SetNativeSize();

            if (destroy)
            {
                await Task.Delay(1000);

                tip.gameObject.SetActive(false);
            }
        }
Пример #13
0
        /// <summary>
        /// 显示叫分
        /// </summary>
        /// <param name="_index"></param>
        /// <param name="score"></param>
        public void CallScoreById(int _index, int score)
        {
            var tip = _rf.Get <GameObject>("Op" + _index).GetComponent <Image>();

            if (score == 0)
            {
                tip.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_bujiaodizhu");
            }
            else
            {
                tip.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_" + score + "fen");
            }

            tip.gameObject.SetActive(true);

            tip.SetNativeSize();

            tip.gameObject.name = "fen";
        }
Пример #14
0
        public void Awake()
        {
            _rf = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>();

            Root = _rf.Get <GameObject>("Root");

            SoundIcon = _rf.Get <GameObject>("SoundIcon").GetComponent <Image>();

            MusicIcon = _rf.Get <GameObject>("MusicIcon").GetComponent <Image>();

            SFxSlider = _rf.Get <GameObject>("SFxSlider").GetComponent <Slider>();

            MusicSlider = _rf.Get <GameObject>("MusicSlider").GetComponent <Slider>();

            SoundIconOpen = SpriteHelper.GetSprite("commonui", "Setting2_yinliang_guan_1");

            SoundIconClose = SpriteHelper.GetSprite("commonui", "Setting2_yinliang_guan");

            MusicIconOpen = SpriteHelper.GetSprite("commonui", "Setting2_yinyue_kai");

            MusicIconClose = SpriteHelper.GetSprite("commonui", "Setting2_yinyue_guan");

            ButtonHelper.RegisterButtonEvent(_rf, "CloseButton", OnClose);

            ButtonHelper.RegisterButtonEvent(_rf, "mask", OnClose);

            ButtonHelper.RegisterButtonEvent(_rf, "SoundIcon", () =>
            {
                SoundComponent.Instance.SfxVolume = this.SoundIcon.sprite == SoundIconOpen ? 0:1;

                SFxSlider.value = SoundComponent.Instance.SfxVolume;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(_rf, "MusicIcon", () =>
            {
                SoundComponent.Instance.SoundVolume = this.MusicIcon.sprite == MusicIconOpen ? 0:1;

                MusicSlider.value = SoundComponent.Instance.SoundVolume;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(_rf, "OneKeyFixBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.FixGameSuccessTip);
            });

            ButtonHelper.RegisterButtonEvent(_rf, "ChangeAccountBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                this.Logout();
            });

            MusicSlider.value = SoundComponent.Instance.SoundVolume;

            SFxSlider.value = SoundComponent.Instance.SfxVolume;

            this.UpdateIcon();


            SFxSlider.onValueChanged.Add((value) =>
            {
                SoundComponent.Instance.SfxVolume = value;

                this.UpdateIcon();
            });

            MusicSlider.onValueChanged.Add((value) =>
            {
                SoundComponent.Instance.SoundVolume = value;

                this.UpdateIcon();
            });
        }
Пример #15
0
    private CropInfo?GetCropInfo(int id, string data)
    {
        // TODO: Create Crop instances so we can
        // lean more on vanilla logic.

        string[] bits = data.Split('/');
        if (bits.Length < 5)
        {
            return(null);
        }

        int sprite  = Convert.ToInt32(bits[2]);
        int harvest = Convert.ToInt32(bits[3]);
        int regrow  = Convert.ToInt32(bits[4]);

        bool isTrellisCrop = bits.Length > 7 && bits[7].Equals("true");

        if (!Game1.objectInformation.ContainsKey(harvest))
        {
            return(null);
        }

        string[] seasons = bits[1].Split(' ', StringSplitOptions.RemoveEmptyEntries);

        WorldDate?startDate = null;
        WorldDate?endDate   = null;

        // TODO: Handle weird crops with a gap.

        foreach (string season in seasons)
        {
            WorldDate start;
            WorldDate end;

            try {
                start = new(1, season, 1);
                end   = new(1, season, ModEntry.DaysPerMonth);
            } catch (Exception) {
                ModEntry.Instance.Log($"Invalid season for crop {id} (harvest:{harvest}): {season}", LogLevel.Warn);
                return(null);
            }

            if (startDate == null || startDate > start)
            {
                startDate = start;
            }
            if (endDate == null || endDate < end)
            {
                endDate = end;
            }
        }


        // Skip crops that don't have any valid seasons.
        // Who knows what else isn't valid?
        if (startDate == null || endDate == null)
        {
            return(null);
        }

        // Skip crops that are always active.
        if (startDate.SeasonIndex == 0 && startDate.DayOfMonth == 1 && endDate.SeasonIndex == (WorldDate.MonthsPerYear - 1) && endDate.DayOfMonth == ModEntry.DaysPerMonth)
        {
            return(null);
        }

        // If the sprite is 23, it's a seasonal multi-seed
        // so we want to show that rather than the seed.
        Item item = new SObject(sprite == 23 ? id : harvest, 1).getOne();

        // Phases
        int[] phases = bits[0].Split(' ').Select(val => Convert.ToInt32(val)).ToArray();

        // Stupid hard coded bullshit.
        bool paddyCrop = harvest == 271 || harvest == 830;

        // Phase Sprites
        // We need an extra sprite for the finished crop,
        // as well as one for regrow if that's enabled.
        SpriteInfo[] sprites = new SpriteInfo[phases.Length + 1 + (regrow > 0 ? 1 : 0)];

        // Are we dealing with colors?
        Color?color = null;

        string[]? colorbits = regrow <= 0 && bits.Length > 8 ? bits[8].Split(' ') : null;
        if (colorbits != null && colorbits.Length >= 4 && colorbits[0].Equals("true"))
        {
            // Technically there could be many colors, but we just use
            // the first one.
            color = new(
                Convert.ToByte(colorbits[1]),
                Convert.ToByte(colorbits[2]),
                Convert.ToByte(colorbits[3])
                );
        }

        for (int i = 0; i < sprites.Length; i++)
        {
            bool final = i == (sprites.Length - (regrow > 0 ? 2 : 1));

            sprites[i] = new(
                Game1.cropSpriteSheet,
                new Rectangle(
                    Math.Min(240, (i + 1) * 16 + (sprite % 2 != 0 ? 128 : 0)),
                    sprite / 2 * 16 * 2,
                    16, 32
                    ),
                overlaySource : final && color.HasValue ? new Rectangle(
                    Math.Min(240, (i + 2) * 16 + (sprite % 2 != 0 ? 128 : 0)),
                    sprite / 2 * 16 * 2,
                    16, 32
                    ) : null,
                overlayColor : final ? color : null
                );
        }

        bool       isGiantCrop = false;
        SpriteInfo?giantSprite = null;

        // Vanilla Giant Crops
        if (harvest == 190 || harvest == 254 || harvest == 276)
        {
            isGiantCrop = true;

            int which;
            if (harvest == 190)
            {
                which = 0;
            }
            else if (harvest == 254)
            {
                which = 1;
            }
            else
            {
                which = 2;
            }

            giantSprite = new(
                Game1.cropSpriteSheet,
                new Rectangle(112 + which * 48, 512, 48, 64)
                );
        }

        // JsonAssets Giant Crops
        if (!isGiantCrop && Mod.intJA != null && Mod.intJA.IsLoaded)
        {
            Texture2D?tex = Mod.intJA.GetGiantCropTexture(harvest);
            if (tex != null)
            {
                isGiantCrop = true;
                giantSprite = new(tex, tex.Bounds);
            }
        }

        // MoreGiantCrops Giant Crops
        if (!isGiantCrop && Mod.intMGC != null && Mod.intMGC.IsGiantCrop(harvest))
        {
            isGiantCrop = true;
            Texture2D?tex = Mod.intMGC.GetGiantCropTexture(harvest);
            if (tex != null)
            {
                giantSprite = new(tex, tex.Bounds);
            }
        }

        return(new(
                   Id: Convert.ToString(id),
                   Item : item,
                   Name : item.DisplayName,
                   Sprite : SpriteHelper.GetSprite(item),
                   IsTrellisCrop : isTrellisCrop,
                   IsGiantCrop : isGiantCrop,
                   GiantSprite : giantSprite,
                   Seeds : new Item[] {
            new SObject(id, 1)
        },
                   Phases : phases,
                   PhaseSprites : sprites,
                   Regrow : regrow,
                   IsPaddyCrop : paddyCrop,
                   StartDate : startDate,
                   EndDate : endDate
                   ));
    }
Пример #16
0
        public void _InitData()
        {
            var myVo = DataCenterComponent.Instance.userInfo.getMyUserVo();

            for (int i = 0; i < 3; i++)
            {
                var item = _rf.Get <GameObject>("Item" + i);

                var _ref = item.GetComponent <ReferenceCollector>();

                var Status = _ref.Get <GameObject>("Status").GetComponent <Image>();

                var HeadBox = _ref.Get <GameObject>("HeadBox").GetComponent <Image>();

                var PlayerHead = _ref.Get <GameObject>("PlayerHead").GetComponent <Image>();

                var PlayerName = _ref.Get <GameObject>("PlayerName").GetComponent <Text>();

                var WinScore = _ref.Get <GameObject>("WinScore").GetComponent <Text>();

                var LoseScore = _ref.Get <GameObject>("LoseScore").GetComponent <Text>();

                var bg = _ref.Get <GameObject>("bg").GetComponent <Image>();

                var baseScore = _ref.Get <GameObject>("baseScore").GetComponent <Text>();

                var besu = _ref.Get <GameObject>("besu").GetComponent <Text>();

                if (DDZGameHelper.settle != null)
                {
                    var playerData = DDZGameHelper.settle.PlayerData[i];

                    int realSeatID = DDZGameHelper.ChangeSeat(playerData.ChairId);

                    PlayerHead.sprite = SpriteHelper.GetPlayerHeadSpriteName(playerData.HeadId);

                    PlayerName.text = playerData.NickeName;

                    Status.sprite = playerData.IsLord ? SpriteHelper.GetSprite("ddzgame", "DDZ_dizhu2") : SpriteHelper.GetSprite("ddzgame", "DDZ_nm");

                    Status.gameObject.SetActive(true);

                    besu.text = DDZGameHelper.settle.Beishu[realSeatID].ToString();



                    if (playerData.Score > 0)
                    {
                        WinScore.gameObject.SetActive(true);

                        LoseScore.gameObject.SetActive(false);

                        WinScore.text = "+" + playerData.Score;
                    }
                    else
                    {
                        WinScore.gameObject.SetActive(false);

                        LoseScore.gameObject.SetActive(true);

                        LoseScore.text = playerData.Score.ToString();
                    }

                    //判断自己的分数为正还是为负
                    if (myVo != null)
                    {
                        if (myVo.userID == playerData.UserId)
                        {
                            PlayerName.color = Color.yellow;

                            baseScore.color = Color.yellow;

                            besu.color = Color.yellow;

                            if (playerData.Score >= 0)
                            {
                                Title.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shengli");

                                //SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_win);

                                Bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shenglidi");

                                winLab.SetActive(true);

                                LoseLab.SetActive(false);

                                bg.gameObject.SetActive(true);

                                bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shenglitiao");
                            }
                            else
                            {
                                Title.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shibai");

                                //SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.DDZ_sound_lose);

                                Bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_shibaidi");

                                winLab.SetActive(false);

                                LoseLab.SetActive(true);

                                bg.gameObject.SetActive(true);

                                bg.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ_Result_sibaitiao");
                            }

                            Title.SetNativeSize();
                        }
                    }
                }
            }

            if (DDZGameHelper.settle != null)
            {
                baseScoreLab.text = "X" + DDZGameHelper.settle.OtherData[0].ToString();

                bombScoreLab.text = "X" + DDZGameHelper.settle.OtherData[1].ToString();

                FlowerScoreLab.text = "X" + DDZGameHelper.settle.OtherData[2].ToString();
            }
        }
Пример #17
0
        public void Awake()
        {
            _rf = this.GetParent <UI>().GameObject.GetComponent <ReferenceCollector>();

            mask = _rf.Get <GameObject>("mask").GetComponent <Button>();

            Root = _rf.Get <GameObject>("Root");

            CloseButton = _rf.Get <GameObject>("CloseButton").GetComponent <Button>();

            pxjsView = _rf.Get <GameObject>("pxjsView");

            wfjsView = _rf.Get <GameObject>("wfjsView");

            pxjsBtn = _rf.Get <GameObject>("pxjsBtn").transform.Find("Text").GetComponent <Text>();

            wfjsBtn = _rf.Get <GameObject>("wfjsBtn").transform.Find("Text").GetComponent <Text>();

            pxBtn = _rf.Get <GameObject>("pxjsBtn").GetComponent <Image>();

            wfBtn = _rf.Get <GameObject>("wfjsBtn").GetComponent <Image>();

            mask.onClick.AddListener(() => { OnClose(); });

            CloseButton.onClick.AddListener(() => { OnClose(); });

            ButtonHelper.RegisterButtonEvent(_rf, "pxjsBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                pxjsBtn.color = Color.yellow;

                wfjsBtn.color = Color.black;

                pxBtn.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_youxuanzhong@2x");

                wfBtn.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_zuoweixuan@2x");

                pxjsView.SetActive(true);

                wfjsView.SetActive(false);
            });

            ButtonHelper.RegisterButtonEvent(_rf, "wfjsBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                pxjsBtn.color = Color.black;

                wfjsBtn.color = Color.yellow;

                pxBtn.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_youweixuan@2x");

                wfBtn.sprite = SpriteHelper.GetSprite("ddzgame", "DDZ2_zuoxuanzhong@2x");

                pxjsView.SetActive(false);

                wfjsView.SetActive(true);
            });

            Root.transform.localScale = Vector3.zero;

            Root.transform.DOScale(1f, 0.2f);
        }
Пример #18
0
 private void SoundCloseAction()
 {
     SettingButtonImg.sprite = SpriteHelper.GetSprite("commonui", "DDZ2_guanbishengyin@2x");
 }
Пример #19
0
 private void SoundShowAction()
 {
     SettingButtonImg.sprite = SpriteHelper.GetSprite("commonui", "DDZ2_kaiqishengyin@2x");
 }
Пример #20
0
        private void InitSettingView()
        {
            _soundSlider = ReferenceCollector.Get <GameObject>("SFxSlider").GetComponent <Slider>();

            _musicSlider = ReferenceCollector.Get <GameObject>("MusicSlider").GetComponent <Slider>();

            SoundIcon = ReferenceCollector.Get <GameObject>("SoundIcon").GetComponent <Image>();

            MusicIcon = ReferenceCollector.Get <GameObject>("MusicIcon").GetComponent <Image>();

            SoundIconOpen = SpriteHelper.GetSprite("commonui", "Setting2_yinliang_guan_1");

            SoundIconClose = SpriteHelper.GetSprite("commonui", "Setting2_yinliang_guan");

            MusicIconOpen = SpriteHelper.GetSprite("commonui", "Setting2_yinyue_kai");

            MusicIconClose = SpriteHelper.GetSprite("commonui", "Setting2_yinyue_guan");

            _musicSlider.value = SoundComponent.Instance.SoundVolume;
            _soundSlider.value = SoundComponent.Instance.SfxVolume;
            this.UpdateIcon();

            _soundSlider.onValueChanged.Add((value) =>
            {
                SoundComponent.Instance.SfxVolume = value;

                this.UpdateIcon();
            });

            _musicSlider.onValueChanged.Add((value) =>
            {
                SoundComponent.Instance.SoundVolume = value;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(ReferenceCollector, "SoundIcon", () =>
            {
                SoundComponent.Instance.SfxVolume = this.SoundIcon.sprite == SoundIconOpen ? 0 : 1;

                _soundSlider.value = SoundComponent.Instance.SfxVolume;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(ReferenceCollector, "MusicIcon", () =>
            {
                SoundComponent.Instance.SoundVolume = this.MusicIcon.sprite == MusicIconOpen ? 0 : 1;

                _musicSlider.value = SoundComponent.Instance.SoundVolume;

                this.UpdateIcon();
            });

            ButtonHelper.RegisterButtonEvent(ReferenceCollector, "OneKeyFixBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                Game.PopupComponent.ShowMessageBox(DataCenterComponent.Instance.tipInfo.FixGameSuccessTip);
            });

            ButtonHelper.RegisterButtonEvent(ReferenceCollector, "ChangeAccountBtn", () =>
            {
                SoundComponent.Instance.PlayClip(DataCenterComponent.Instance.soundInfo.click);

                this.Logout();
            });
        }