Example #1
0
        private async void RequestDailySignState()
        {
            UINetLoadingComponent.showNetLoading();
            G2C_DailySignState g2cDailySignState = (G2C_DailySignState)await SessionComponent.Instance.Session.Call(new C2G_DailySignState { Uid = PlayerInfoComponent.Instance.uid });

            UINetLoadingComponent.closeNetLoading();

            bool TodayIsSign = g2cDailySignState.TodayIsSign;

            if (TodayIsSign)
            {
                Button btn = Item2.transform.Find("Button").GetComponent <Button>();
                btn.interactable = false;
                btn.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "DayDo_tomorrow");

                string TomorrowReward = g2cDailySignState.TomorrowReward;
                int    prop_id        = CommonUtil.splitStr_Start(TomorrowReward, ':');
                int    prop_num       = CommonUtil.splitStr_End(TomorrowReward, ':');
                Item2.transform.Find("Text").GetComponent <Text>().text = ("奖励 <color=#FF8604FF>" + prop_num + "</color>金币");
            }
            else
            {
                string TodayReward = g2cDailySignState.TodayReward;
                int    prop_id     = CommonUtil.splitStr_Start(TodayReward, ':');
                int    prop_num    = CommonUtil.splitStr_End(TodayReward, ':');
                Item2.transform.Find("Text").GetComponent <Text>().text = ("奖励 <color=#FF8604FF>" + prop_num + "</color>金币");
            }
        }
Example #2
0
        private async void RequestDailySign()
        {
            UINetLoadingComponent.showNetLoading();

            G2C_DailySign g2cDailySign = (G2C_DailySign)await SessionComponent.Instance.Session.Call(new C2G_DailySign { Uid = PlayerInfoComponent.Instance.uid });

            UINetLoadingComponent.closeNetLoading();

            if (g2cDailySign.Error != ErrorCode.ERR_Success)
            {
                ToastScript.createToast(g2cDailySign.Message);

                return;
            }

            string reward = g2cDailySign.Reward;

            GameUtil.changeDataWithStr(reward);

            ShowRewardUtil.Show(reward);

            PlayerInfoComponent.Instance.GetPlayerInfo().IsSign = true;

            {
                Button btn = Item2.transform.Find("Button").GetComponent <Button>();
                btn.interactable = false;
                btn.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", "DayDo_tomorrow");

                string TomorrowReward = g2cDailySign.TomorrowReward;
                int    prop_id        = CommonUtil.splitStr_Start(TomorrowReward, ':');
                int    prop_num       = CommonUtil.splitStr_End(TomorrowReward, ':');
                Item2.transform.Find("Text").GetComponent <Text>().text = ("奖励 <color=#FF8604FF>" + prop_num + "</color>金币");
            }
        }
Example #3
0
        /// <summary>
        /// 显示四连风 2,四连风;3,fafen
        /// </summary>
        /// <param name="type"></param>
        public async void ShowAnim(int type)
        {
            switch (type)
            {
            case 1:
                break;

            case 2:
                showAnimImage.sprite = CommonUtil.getSpriteByBundle("Image_GameAnimation", "silianfeng");
                break;

            case 3:
                showAnimImage.sprite = CommonUtil.getSpriteByBundle("Image_GameAnimation", "fafen");
                break;

            case 4:
                break;
            }

            showAnimImage.gameObject.SetActive(true);

            showAnimImage.SetNativeSize();
            await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(1500);

            if (this.IsDisposed)
            {
                return;
            }

            showAnimImage.gameObject.SetActive(false);
        }
Example #4
0
        /// <summary>
        /// 开始倒计时
        /// </summary>
        /// <param name="time"></param>
        public async void StartTime(int time = 9)
        {
            try
            {
                if (tokenSource != null)
                {
                    tokenSource.Cancel();
                }

                tokenSource      = new CancellationTokenSource();
                timeImage.sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "time_" + time);
                while (time > 0)
                {
                    if (tokenSource.Token.IsCancellationRequested)
                    {
                        return;
                    }
                    await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(1000, tokenSource.Token);

                    time--;
                    timeImage.sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "time_" + time);
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Example #5
0
        /// <summary>
        /// 玩家出牌
        /// </summary>
        /// <param name="mahjong"></param>
        /// <param name="messageIndex"></param>
        /// <param name="messageWeight"></param>
        public async void PlayCard(MahjongInfo mahjong, int index, GameObject currentItem)
        {
            try
            {
                for (int i = 0; i < handCards.Count; i++)
                {
                    if (handCards[i].weight == mahjong.weight)
                    {
                        GameObject gameObject = this.GetSprite(i);
                        GameObject.Destroy(gameObject);
                        handCards.RemoveAt(i);
                        playCards.Add(mahjong);
                        ItemCards.RemoveAt(i);
                        break;
                    }
                }

                UpdateCards();

                //显示出牌
                GameObject obj  = (GameObject)this.resourcesComponent.GetAsset("Item_Vertical_Card.unity3d", "Item_Vertical_Card");
                GameObject obj2 = (GameObject)this.resourcesComponent.GetAsset("Image_Top_Card.unity3d", "Image_Top_Card");
                this.currentPlayCardObj = GameObject.Instantiate(obj, this.cardDisplay.transform);

                currentPlayCardObj.GetComponent <Image>().sprite = obj2.Get <Sprite>("card_" + mahjong.weight);
                currentPlayCardObj.layer = LayerMask.NameToLayer("UI");

                currentItem = currentPlayCardObj;

                ShowCard(mahjong.weight);

                //出了几张一样的牌
                int playCount = 0;
                foreach (var card in playCards)
                {
                    if (card.weight == mahjong.weight)
                    {
                        playCount++;
                    }
                }
                if (playCount == 3)
                {
                    UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                    UIRoomComponent uiRoomComponent = uiRoom.GetComponent <UIRoomComponent>();
                    uiRoomComponent.tip.SetActive(true);
                    uiRoomComponent.tip.GetComponentInChildren <Image>().sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "foursame_tip");
                    await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(3000);

                    if (this.IsDisposed)
                    {
                        return;
                    }
                    uiRoomComponent?.tip?.SetActive(false);
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Example #6
0
        private void CreatePlayerIconList()
        {
            GameObject obj = null;

            for (int i = 0; i < iconCount; ++i)
            {
                if (i < iconList.Count)
                {
                    obj = iconList[i];
                }
                else
                {
                    obj = GameObject.Instantiate(iconObj);
                    obj.transform.SetParent(grid.transform);
                    obj.transform.localScale = Vector3.one;
                    UI ui = ComponentFactory.Create <UI, GameObject>(obj);
                    ui.AddComponent <UIPlayerIconItemComponent>();
                    iconList.Add(obj);
                    uiList.Add(ui);
                }
                if (curIconStr == iconStr[i])
                {
                    uiList[i].GetComponent <UIPlayerIconItemComponent>().SetSelect(true);
                }
                else
                {
                    uiList[i].GetComponent <UIPlayerIconItemComponent>().SetSelect(false);
                }
                Sprite sprite = CommonUtil.getSpriteByBundle("playericon", iconStr[i]);
                uiList[i].GetComponent <UIPlayerIconItemComponent>().SetIcon(sprite, i);
            }
        }
 public void FanPai()
 {
     for (int i = 0; i < CardBottom.transform.childCount; i++)
     {
         CardBottom.transform.GetChild(i).GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("Image_Bottom_Card", "bottom_back");
     }
 }
        /// <summary>
        /// 碰刚
        /// </summary>
        /// <param name="messageOperationType"></param>
        /// <param name="mahjong"></param>
        public void SetPengGang(int messageOperationType, MahjongInfo mahjong)
        {
            Log.Debug("显示碰后杠");
            GameObject obj   = CommonUtil.getGameObjByBundle("Item_Gang_Card");
            int        index = Logic_NJMJ.getInstance().GetIndex(this.handCards, mahjong);

            this.RemoveCard(index);
            UpdateCards();

            //显示碰
            GameObject gameObject = GameObject.Instantiate(obj, this.pengObj.transform);

            for (int i = 0; i < 2; i++)
            {
                gameObject.transform.GetChild(i).GetComponent <Image>().sprite =
                    CommonUtil.getSpriteByBundle("Image_Top_Card", "card_" + mahjong.weight);
            }

            GameObject lastPengObj = null;

            if (pengDic.TryGetValue(mahjong.weight, out lastPengObj))
            {
                gameObject.transform.SetSiblingIndex(lastPengObj.transform.GetSiblingIndex());
                gameObject.transform.localPosition = lastPengObj.transform.localPosition;
                GameObject.Destroy(lastPengObj);
                pengDic.Remove(mahjong.weight);
            }
        }
Example #9
0
        public static void Show(GameObject parent)
        {
            // 同一时间只能显示一个手指
            if (s_finger != null)
            {
                GameObject.Destroy(s_finger);
                s_finger = null;
            }

            // 显示手指
            {
                s_finger = new GameObject();
                Image img = s_finger.AddComponent <Image>();
                img.sprite = CommonUtil.getSpriteByBundle("image_main", "finger");

                s_finger.transform.SetParent(parent.transform);
                s_finger.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);

                Vector3 pos = new Vector3(30, -30, 0);
                s_finger.transform.localPosition = pos;

                {
                    Sequence seq = DOTween.Sequence();
                    seq.Append(s_finger.GetComponent <RectTransform>().DOAnchorPos(new Vector2(pos.x - 15, pos.y + 15), 0.5f, false))
                    .Append(s_finger.GetComponent <RectTransform>().DOAnchorPos(new Vector2(pos.x, pos.y), 0.5f, false)).SetLoops(-1).Play();
                }
            }
        }
Example #10
0
        public void SetFlowGame(Actor_GameFlow message, GamerComponent gamerComponent)
        {
            Gamer[] gamers = gamerComponent.GetAll();

            for (int i = 0; i < gamers.Length; i++)
            {
                if (gamers[i] == null)
                {
                    continue;
                }
                if (gamers[i].UserID == PlayerInfoComponent.Instance.uid)
                {
                    playerList.Insert(i, winPlayer);
                }
            }

            for (int i = 0; i < gamers.Length; i++)
            {
                Gamer      gamer      = gamers[i];
                GameObject gameObject = this.playerList[i];
                Image      headImage  = gameObject.transform.Find("head").GetComponent <Image>();
                Text       nameText   = gameObject.transform.Find("name").GetComponent <Text>();
                Text       goldText   = gameObject.transform.Find("Text_gold").GetComponent <Text>();

                HeadManager.setHeadSprite(headImage, gamer.PlayerInfo.Icon);
                nameText.text = gamer.PlayerInfo.Name;
                goldText.text = 0 + "";
            }

            winPlayer.transform.Find("hupaiType").GetComponent <Image>().sprite =
                CommonUtil.getSpriteByBundle("image_gameresult", "gameresult_liuju");
        }
Example #11
0
        /// <summary>
        /// 设置我的战绩榜信息
        /// </summary>
        private void SetMyGameRank()
        {
            string str = "";

            if (!isGameRank)
            {
                RankTxt.gameObject.SetActive(true);
                RankImg.SetActive(false);
                str = "未上榜";
            }
            else
            {
                if (ownGame < 3)
                {
                    RankTxt.gameObject.SetActive(false);
                    RankImg.SetActive(true);
                    string iconName = new StringBuilder().Append("Rank_")
                                      .Append(ownGame + 1).ToString();
                    RankImg.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_main", iconName);
                }
                else
                {
                    RankTxt.gameObject.SetActive(true);
                    RankImg.SetActive(false);
                    str = (ownGame + 1).ToString();
                }
            }
            RankTxt.text = str;
            NameTxt.text = ownGameRank.PlayerName;
            GoldTxt.text = new StringBuilder().Append(ownGameRank.WinCount)
                           .ToString();
            Img.sprite = CommonUtil.getSpriteByBundle("image_main", "win");
            RewardBtn.gameObject.SetActive(g2cWeek.IsGetGameRank);
            HeadManager.setHeadSprite(Icon, PlayerInfoComponent.Instance.GetPlayerInfo().Icon);
        }
        private async void GetReward()
        {
            UINetLoadingComponent.showNetLoading();
            G2C_GetTaskReward g2cGet = (G2C_GetTaskReward)await SessionComponent.Instance.Session.Call(new C2G_GetTaskReward { UId = PlayerInfoComponent.Instance.uid, TaskInfo = info, GetType = 2 });

            UINetLoadingComponent.closeNetLoading();

            if (g2cGet.Error != ErrorCode.ERR_Success)
            {
                ToastScript.createToast(g2cGet.Message);
            }
            else
            {
                GameUtil.changeData(1, info.Reward);
                Game.Scene.GetComponent <UIComponent>().Get(UIType.UIMain)
                .GetComponent <UIMainComponent>().refreshUI();

                string str = "1:" + info.Reward;
                ShowRewardUtil.Show(str);
                string icon = new StringBuilder().Append("chengjiu_")
                              .Append(info.Id).ToString();
                Debug.Log("已经领取成就奖励");
                Game.Scene.GetComponent <UIComponent>().Get(UIType.UIChengjiu).GetComponent <UIChengjiuComponent>().DeCount();
                Complete.SetActive(false);
                ChengjiuItemBtn.GetComponent <Image>().sprite =
                    CommonUtil.getSpriteByBundle("uichengjiuicon", icon);
            }
        }
Example #13
0
        public void SetExpression(int index)
        {
            this.index = index;
            string icon = new StringBuilder().Append("ExpressionImg_")
                          .Append(index).ToString();

            UIExpression.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("expression", icon);
        }
Example #14
0
        public static async void Start(Image image, string bundleName, string animationName, long durtime, CallBack callBack, bool isLoop = false, bool indexIsGuDingLength = false)
        {
            int i = 0;

            while (true)
            {
                Sprite sprite;

                if (!indexIsGuDingLength)
                {
                    sprite = CommonUtil.getSpriteByBundle(bundleName, animationName + (++i));
                }
                else
                {
                    string name = animationName;;
                    if (++i > 9)
                    {
                        name += i;
                    }
                    else
                    {
                        name += ("0" + i);
                    }

                    sprite = CommonUtil.getSpriteByBundle(bundleName, name);
                }

                if (sprite != null)
                {
                    if (image != null)
                    {
                        image.sprite = sprite;
                        await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(durtime);
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    if (isLoop)
                    {
                        i = 0;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (callBack != null)
            {
                callBack();
            }
        }
Example #15
0
        public static async void ShowPlusGoldChange(GameObject gameObject, int num)
        {
            numList.Clear();
            //            int unitPlace = num / 1 % 10;
            //            int tenPlace = num / 10 % 10;
            //            int hundredPlace = num / 100 % 10;
            //            int thousandPlace = num / 1000 % 10;
            //            int wPlace = num / 10000 % 10;

            //第一位是否是0
            bool isStart = true;

            for (int i = 6; i >= 0; i--)
            {
                int pow  = (int)Math.Pow(10, i);
                int temp = num / pow % 10;
                if (isStart)
                {
                    if (temp > 0)
                    {
                        numList.Add(temp);
                        isStart = false;
                    }
                }
                else
                {
                    numList.Add(temp);
                }
            }

            GameObject obj   = new GameObject();
            Image      image = obj.AddComponent <Image>();

            image.sprite = CommonUtil.getSpriteByBundle("Image_Plus_Gold", "plus");
            obj.transform.SetParent(gameObject.transform);
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = Vector3.one;
            foreach (var item in numList)
            {
                obj          = new GameObject();
                image        = obj.AddComponent <Image>();
                image.sprite = CommonUtil.getSpriteByBundle("Image_Plus_Gold", item + "");
                obj.transform.SetParent(gameObject.transform);
                obj.transform.localScale    = Vector3.one;
                obj.transform.localPosition = Vector3.one;
            }

            Vector3 localPosition = gameObject.transform.localPosition;

            gameObject.GetComponent <RectTransform>().DOAnchorPos(new Vector2(localPosition.x, localPosition.y + 30), 1.5f, false).OnComplete(() =>
            {
                //Log.Debug("完成");
                gameObject.transform.localPosition = localPosition;
                DeleteAllItem(gameObject);
            });
        }
Example #16
0
 public void SetItemInfo(Bag item)
 {
     this.item = item;
     propInfo  = PropConfig.getInstance().getPropInfoById((int)item.ItemId);
     if (propInfo == null)
     {
         Debug.LogError("道具信息错误");
     }
     useBtn.gameObject.SetActive(propInfo.type == 1);
     uiItemIcon.sprite = CommonUtil.getSpriteByBundle("image_shop", propInfo.prop_id.ToString());
     descTxt.text      = propInfo.desc;
 }
Example #17
0
 /// <summary>
 /// 补花
 /// </summary>
 /// <param name="weight"></param>
 public void SetBuHua(int weight)
 {
     try
     {
         GameObject obj = CommonUtil.getGameObjByBundle("Item_Top_Card");
         obj.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("Image_Top_Card", "card_" + weight);
         GameObject.Instantiate(obj, FaceObj.transform);
     }
     catch (Exception e)
     {
         Log.Error(e);
     }
 }
Example #18
0
 public void ResetReadyPanel()
 {
     if (readyName == null)
     {
         return;
     }
     readyName.text           = "";
     readyHead.sprite         = CommonUtil.getSpriteByBundle("Image_Desk_Card", "icon_default");
     readyText.text           = "";
     vip.transform.localScale = Vector3.zero;
     headReadyInfo.gameObject.SetActive(false);
     this.headReadyInfo.GetComponentInParent <Button>().onClick.RemoveAllListeners();
 }
Example #19
0
        public void SetInfo(FriendRoomRecordInfo info, int id)
        {
            this.info  = info;
            this.index = id;
            AccountAllScore();
            MyAccountAllScore();
            int        allScore = 0;
            List <int> myList   = MyScore(PlayerInfoComponent.Instance.uid);

            if (myList != null)
            {
                for (int i = 0; i < myList.Count; ++i)
                {
                    allScore += myList[i];
                }
            }

            if (allScore >= 0)
            {
                ScoreTxt.text = "+" + allScore.ToString();
            }
            else
            {
                ScoreTxt.text = allScore.ToString();
            }
            Result.sprite = CommonUtil.getSpriteByBundle("image_main", allScore >= 0 ? "win" : "fail");

            RoomIdTxt.text = info.roomNum.ToString();
            TimeTxt.text   = info.time.ToString();

            GameObject obj   = null;
            int        index = 0;

            foreach (var score in scoreDic)
            {
                if (index < objList.Count)
                {
                    obj = objList[index];
                }
                else
                {
                    obj = GameObject.Instantiate(item, AccountGrid.transform);
                    UI ui = ComponentFactory.Create <UI, GameObject>(obj);
                    ui.AddComponent <UIFriendRoomTxtComponent>();
                    uiList.Add(ui);
                    objList.Add(obj);
                }
                uiList[index].GetComponent <UIFriendRoomTxtComponent>().SetInfo(score.Key, score.Value);
                index++;
            }
        }
Example #20
0
        /// <summary>
        /// 设置宝箱倒计时
        /// </summary>
        /// <param name="onlineSeconds"></param>
        public async void SetTreasureTime(int onlineSeconds)
        {
            try
            {
                Log.Debug("宝箱倒计时:" + onlineSeconds);
                this.treasure.SetActive(true);
                Text   timeText = this.treasure.transform.Find("Text").GetComponent <Text>();
                Image  image    = this.treasure.GetComponent <Image>();
                Button button   = this.treasure.GetComponent <Button>();
                image.sprite        = CommonUtil.getSpriteByBundle("Image_Desk_Card", "Treasure_Close");
                button.interactable = false;
                isTreasureFinish    = false;

                if (onlineSeconds < 0)
                {
                    this.treasure.SetActive(false);
                    return;
                }

                while (onlineSeconds > 0)
                {
                    await ETModel.Game.Scene.GetComponent <TimerComponent>().WaitAsync(1000);

                    if (isTreasureFinish || this.IsDisposed)
                    {
                        return;
                    }
                    onlineSeconds--;
                    int second = onlineSeconds % 60;
                    int minute = onlineSeconds / 60;
                    if (second < 10)
                    {
                        timeText.text = $"{minute}:0{second}";
                    }
                    else
                    {
                        timeText.text = $"{minute}:{second}";
                    }
                }

                timeText.text       = "0:00";
                image.sprite        = CommonUtil.getSpriteByBundle("Image_Desk_Card", "Treasure_Open");
                button.interactable = true;
                button.onClick.RemoveAllListeners();
                button.onClick.Add(OnGetTreasure);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
Example #21
0
 public void SetItemInfo(Bag item, int index)
 {
     this.item = item;
     if (index % 3 == 1)
     {
         uiBagBgL.SetActive(true);
     }
     else
     {
         uiBagBgL.SetActive(false);
     }
     uiBagIcon.sprite = CommonUtil.getSpriteByBundle("image_shop", item.ItemId.ToString());
     countTxt.text    = item.Count.ToString();
 }
Example #22
0
 public void SetCommonItem(ShopInfo info)
 {
     shopInfo     = info;
     nameTxt.text = info.Name;
     icon.sprite  = CommonUtil.getSpriteByBundle("Image_Shop", info.Icon);
     if (info.ShopType == (int)ShopType.Wing)
     {
         priceTxt.text = new StringBuilder().Append(info.Price).Append("元").ToString();
     }
     else
     {
         priceTxt.text = info.Price.ToString();
     }
 }
Example #23
0
        /// <summary>
        /// 设置点击详细信息
        /// </summary>
        /// <param name="info"></param>
        /// <param name="isGet"></param>
        public void SetDetail(TaskInfo info, bool isGet)
        {
            Detail.SetActive(true);
            ProgressTxt.text = new StringBuilder().Append(info.Progress).Append("/").Append(info.Target).ToString();
            ContentTxt.text  = info.Desc;
            NameTxt.text     = info.TaskName;
            RewardTxt.text   = new StringBuilder().Append("金币").Append(info.Reward).ToString();
            string icon = new StringBuilder().Append("chengjiu_").Append(info.Id).ToString();

            ChengIcon.sprite = CommonUtil.getSpriteByBundle("uichengjiuicon", icon);
            AlGet.SetActive(isGet);
            if (AlGet.gameObject.activeInHierarchy)
            {
                ProgressTxt.text = new StringBuilder().Append(info.Target).Append("/").Append(info.Target).ToString();
            }
        }
Example #24
0
        void xuanzhongItem(int itemId)
        {
            for (int i = 0; i < ZhuanPanConfig.getInstance().getZhuanPanInfoList().Count; i++)
            {
                ZhuanPanInfo zhuanpanInfo = ZhuanPanConfig.getInstance().getZhuanPanInfoList()[i];
                GameObject   item         = Item.transform.Find("Item_" + zhuanpanInfo.itemId).gameObject;

                if (zhuanpanInfo.itemId == itemId)
                {
                    item.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "item_xuanzhong");
                }
                else
                {
                    item.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_zhuanpan", "item_weixuanzhong");
                }
            }
        }
Example #25
0
        public void showPanel(int tab)
        {
            switch (tab)
            {
            case 1:
            {
                panel_guize.transform.localScale  = new Vector3(1, 1, 1);
                panel_kefu.transform.localScale   = new Vector3(0, 0, 0);
                panel_guanyu.transform.localScale = new Vector3(0, 0, 0);

                btn_guize.GetComponent <Image>().sprite  = CommonUtil.getSpriteByBundle("image_help", "btn_yxgz_pressed");
                btn_kefu.GetComponent <Image>().sprite   = CommonUtil.getSpriteByBundle("image_help", "btn_kefu");
                btn_guanyu.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_help", "btn_guanyu");
            }
            break;

            case 2:
            {
                panel_guize.transform.localScale  = new Vector3(0, 0, 0);
                panel_kefu.transform.localScale   = new Vector3(1, 1, 1);
                panel_guanyu.transform.localScale = new Vector3(0, 0, 0);

                btn_guize.GetComponent <Image>().sprite  = CommonUtil.getSpriteByBundle("image_help", "btn_yxgz");
                btn_kefu.GetComponent <Image>().sprite   = CommonUtil.getSpriteByBundle("image_help", "btn_kefu_pressed");
                btn_guanyu.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_help", "btn_guanyu");
            }
            break;

            case 3:
            {
                panel_guize.transform.localScale  = new Vector3(0, 0, 0);
                panel_kefu.transform.localScale   = new Vector3(0, 0, 0);
                panel_guanyu.transform.localScale = new Vector3(1, 1, 1);

                btn_guize.GetComponent <Image>().sprite  = CommonUtil.getSpriteByBundle("image_help", "btn_yxgz");
                btn_kefu.GetComponent <Image>().sprite   = CommonUtil.getSpriteByBundle("image_help", "btn_kefu");
                btn_guanyu.GetComponent <Image>().sprite = CommonUtil.getSpriteByBundle("image_help", "btn_guanyu_pressed");
            }
            break;
            }
        }
        /// <summary>
        /// 设置花牌
        /// </summary>
        /// <param name="gameDataFaceCards"></param>
        public void SetFaceCards(List <MahjongInfo> gameDataFaceCards)
        {
            faceCard.SetActive(true);

            faceCards = gameDataFaceCards;

            int geWei  = gameDataFaceCards.Count % 10;
            int shiWei = gameDataFaceCards.Count / 10;

            if (shiWei > 0)
            {
                faceImageGe.gameObject.SetActive(true);
                faceImage.sprite   = CommonUtil.getSpriteByBundle("Image_Desk_Card", "time_" + shiWei);
                faceImageGe.sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "time_" + geWei);
            }
            else
            {
                faceImageGe.gameObject.SetActive(false);
                faceImage.sprite = CommonUtil.getSpriteByBundle("Image_Desk_Card", "time_" + gameDataFaceCards.Count);
            }
        }
Example #27
0
        public static void SetRoomId(GameObject gameObject, int num)
        {
            numList.Clear();
            //            int unitPlace = num / 1 % 10;
            //            int tenPlace = num / 10 % 10;
            //            int hundredPlace = num / 100 % 10;
            //            int thousandPlace = num / 1000 % 10;
            //            int wPlace = num / 10000 % 10;

            //第一位是否是0
            bool isStart = true;

            for (int i = 6; i >= 0; i--)
            {
                int pow  = (int)Math.Pow(10, i);
                int temp = num / pow % 10;
                if (isStart)
                {
                    if (temp > 0)
                    {
                        numList.Add(temp);
                        isStart = false;
                    }
                }
                else
                {
                    numList.Add(temp);
                }
            }

            foreach (var item in numList)
            {
                GameObject obj   = new GameObject();
                Image      image = obj.AddComponent <Image>();
                image.sprite = CommonUtil.getSpriteByBundle("Image_RoomId", item + "");
                obj.transform.SetParent(gameObject.transform);
                obj.transform.localScale    = Vector3.one;
                obj.transform.localPosition = Vector3.one;
            }
        }
Example #28
0
        public void SetGoldItem(WealthRank wealth, int index)
        {
            RankImg.gameObject.SetActive(index < 3);
            RankTxt.gameObject.SetActive(index >= 3);
            if (RankTxt.gameObject.activeInHierarchy)
            {
                RankTxt.text = (index + 1).ToString();
            }
            NameTxt.text = wealth.PlayerName;
            GoldTxt.text = new StringBuilder().Append(wealth.GoldNum)
                           .ToString();
            Img.sprite = CommonUtil.getSpriteByBundle("image_shop", "icon_jinbi");
            HeadManager.setHeadSprite(Icon, wealth.Icon);
            string rIcon = new StringBuilder().Append("Rank_")
                           .Append(index + 1)
                           .ToString();

            if (RankImg.gameObject.activeInHierarchy)
            {
                RankImg.sprite = CommonUtil.getSpriteByBundle("image_main", rIcon);
            }
        }
Example #29
0
        public void SetGameItem(GameRank gameRank, int index)
        {
            RankImg.gameObject.SetActive(index < 3);
            RankTxt.gameObject.SetActive(index >= 3);
            NameTxt.text = gameRank.PlayerName;
            Img.sprite   = CommonUtil.getSpriteByBundle("image_main", "win");
            GoldTxt.text = new StringBuilder().Append(gameRank.WinCount)
                           .ToString();
            if (RankTxt.gameObject.activeInHierarchy)
            {
                RankTxt.text = (index + 1).ToString();
            }
            HeadManager.setHeadSprite(Icon, gameRank.Icon);
            string rIcon = new StringBuilder().Append("Rank_")
                           .Append(index + 1)
                           .ToString();

            if (RankImg.gameObject.activeInHierarchy)
            {
                RankImg.sprite = CommonUtil.getSpriteByBundle("image_main", rIcon);
            }
        }
        public void SetInfo(TaskInfo info)
        {
            this.info = info;
            string icon = new StringBuilder().Append("chengjiu1_")
                          .Append(info.Id).ToString();

            if (info.IsComplete)
            {
                //未领取
                if (!info.IsGet)
                {
                    Complete.SetActive(true);
                }
                else
                {
                    icon = new StringBuilder().Append("chengjiu_")
                           .Append(info.Id).ToString();
                    Complete.SetActive(false);
                }
            }
            ChengjiuItemBtn.GetComponent <Image>().sprite =
                CommonUtil.getSpriteByBundle("uichengjiuicon", icon);
        }