Example #1
0
 void AskActivityDone(bool isSuccess)
 {
     if (isSuccess)
     {
         mainLogic.OnGGLWindow();
     }
 }
    void OnEnable()
    {
        if (mainLogic == null)
        {
            mainLogic = GameObject.Find("MainUILogic").GetComponent <MainUILogic>();
        }
        if (mainController == null)
        {
            mainController = GameObject.Find("MainController").GetComponent <MainController>();
        }

        mainController.ShowActivityTopUI(ActivityType.E_ACTIVITY_TYPE_CHANGE_CARD);
        mainLogic.SetMainUIBottomBarActive(true);

        lastClicked = null;
        intro.SetActive(false);
        changeConfirm.isEnabled = false;
        changeConfirm.transform.FindChild("Sprite").GetComponent <UISprite>().spriteName = "xianrendian_grey";
        timesPrompt.SetActive(false);
        isBlock = false;
        int    count    = Obj_MyselfPlayer.GetMe().changeCardInfo.Count;
        double endTimer = Obj_MyselfPlayer.GetMe().changeCardTimer;

        LogModule.DebugLog("ChangeCard Timer = " + endTimer);
        LogModule.DebugLog("ChangeCard Count = " + count);
        if (endTimer < 0)
        {
            mainLogic.OnGGLWindow();
            return;
        }
        int days   = (int)(endTimer / 3600 / 24);
        int hour   = (int)(endTimer / 3600 - days * 24);
        int minute = (int)((endTimer % 3600) / 60);

        timerLabel.text = string.Format("活动倒计时:{0}天{1}小时{2}分", days, hour, minute);
        int childCount = grid.transform.childCount;

        for (int i = childCount - 1; i >= 0; i--)
        {
            Destroy(grid.transform.GetChild(i).gameObject);
        }
        grid.GetComponent <UIGrid>().repositionNow = true;
        for (int i = 0; i < count; i++)
        {
            GameObject cardItem = ResourceManager.Instance.loadWidget(changeCardItem);
            cardItem.transform.FindChild("bg").gameObject.GetComponent <UISprite>().spriteName = "liebiao_beijing_1";
            cardItem.name                          = (i + 1).ToString();
            cardItem.transform.parent              = grid.transform;
            cardItem.transform.localScale          = new Vector3(1, 1, 1);
            UIEventListener.Get(cardItem).onClick += ClickAtItem;
            ChangeCardInfo info       = Obj_MyselfPlayer.GetMe().changeCardInfo[i];
            int[]          changeType = { info.ChangeType_1, info.ChangeType_2, info.ChangeType_3 };
            int[]          changeNum  = { info.ChangeNum_1, info.ChangeNum_2, info.ChangeNum_3 };
            LogModule.DebugLog("--------------------------------------------------");
            LogModule.DebugLog("[ " + (i + 1) + " ] - > changeType_1 = " + info.ChangeType_1);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > changeNum_1  = " + info.ChangeNum_1);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > changeType_2 = " + info.ChangeType_2);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > changeNum_2  = " + info.ChangeNum_2);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > changeType_3 = " + info.ChangeType_3);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > changeNum_3  = " + info.ChangeNum_3);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > resultID     = " + info.ResultID);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > cardInfoID   = " + info.CardInfoID);
            LogModule.DebugLog("[ " + (i + 1) + " ] - > times        = " + info.Times);
            LogModule.DebugLog("--------------------------------------------------");
//			UILabel times = cardItem.transform.FindChild("times").GetComponent<UILabel>();
//			times.text = string.Format("剩余:{0}次",info.Times);
            for (int m = 1; m <= 3; m++)
            {
                LogModule.DebugLog("ChangeCard");
                GameObject item  = cardItem.transform.FindChild("item" + m).gameObject;
                UILabel    label = item.transform.FindChild("Label").GetComponent <UILabel>();
                if (changeType[m - 1] > 2)               //换卡条件为: 卡牌
                {
                    string cardName = TableManager.GetCardByID(changeType[m - 1]).Note;
                    label.text = string.Format(cardName + "x" + changeNum[m - 1]);
                    UISprite cardIcon  = item.transform.FindChild("Sprite-Icon").GetComponent <UISprite>();
                    string   atlasName = TableManager.GetAppearanceByID(TableManager.GetCardByID(changeType[m - 1]).Appearance).HeadIcon;
                    Vector3  oldScale  = cardIcon.transform.localScale;
                    AtlasManager.Instance.setHeadName(cardIcon, atlasName);
                    cardIcon.transform.localScale = oldScale;

                    UISprite icon_bg     = item.transform.FindChild("Sprite-BG").GetComponent <UISprite>();
                    UISprite icon_border = item.transform.FindChild("Sprite").GetComponent <UISprite>();
                    int      icon_star   = TableManager.GetCardByID(changeType[m - 1]).Star;
                    icon_bg.spriteName     = UserCardItem.littleCardFrameName[icon_star];
                    icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star];
                }
                else
                {
                    string str = changeTypeStr[changeType[m - 1] - 1];
                    label.text = string.Format(str, changeNum[m - 1]);
                    UISprite cardIcon = item.transform.FindChild("Sprite-Icon").GetComponent <UISprite>();
                    string   name     = "jinbi";
                    if (changeType[m - 1] == 1)                   //元宝
                    {
                        name = "yuanbao";
                    }
                    cardIcon.spriteName = name;
//                  cardIcon.transform.localScale = new Vector3(82, 82, 1);

                    UISprite icon_bg     = item.transform.FindChild("Sprite-BG").GetComponent <UISprite>();
                    UISprite icon_border = item.transform.FindChild("Sprite").GetComponent <UISprite>();
                    icon_bg.spriteName     = UserCardItem.littleCardFrameName[7];
                    icon_border.spriteName = UserCardItem.littleCardBorderName[7];
                }
            }
            if (info.ResultID >= 5)
            {
                info.ResultID = 4;
            }
            GameObject item4 = cardItem.transform.FindChild("item4").gameObject;
            UISprite   icon  = item4.transform.FindChild("Sprite-Icon").GetComponent <UISprite>();
            icon.spriteName = "cardalbum_" + info.ResultID;
            item4.transform.FindChild("Label").GetComponent <UILabel>().text = changeTypeStr[info.ResultID + 1];
        }
    }
Example #3
0
 void ShowGGL()
 {
     mainLogic.OnGGLWindow();
 }