Example #1
0
        void OnSignUpdated(Signage sign, BasePlayer player, string text)
        {
            uint signId = sign.net.ID;

            SignItem signItem;

            if (m_signsLogs.SignItems.ContainsKey(signId))
            {
                signItem = m_signsLogs.SignItems[signId];
            }
            else
            {
                signItem = new SignItem();
                m_signsLogs.SignItems[signId] = signItem;
            }

            AccessItem accessItem;

            if (signItem.AccessItems.ContainsKey(player.userID))
            {
                accessItem = signItem.AccessItems[player.userID];
            }
            else
            {
                accessItem = new AccessItem();
                signItem.AccessItems[player.userID] = accessItem;
            }

            accessItem.dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        }
Example #2
0
        //根据不同类型添加商品item,显示名字、价格等
        private void AddGrid(Transform gridTr, List <AwardUnit> list)
        {
            foreach (Transform VARIABLE in gridTr)
            {
                GameObject.Destroy(VARIABLE.gameObject);
            }

            for (int i = 0; i < 7; i++)
            {
                GameObject go   = GameObject.Instantiate(ItemPrefab.UnityObj) as GameObject;
                SignItem   item = go.AddComponent <SignItem>();
                item.SetData(list[i]);

                items.Add(item);

                go.transform.SetParent(gridTr);
                go.transform.localScale = new Vector3(1, 1, 1);

                Debug.Log(string.Format("<color=#ffffffff><---{0}-{1}----></color>", i, Continuedays - 1));

                if (i <= Continuedays - 1)
                {
                    item.ShowGetMask();
                }
            }
        }
Example #3
0
        private void AddCustomSurnameRow(SignItem item, int rowIdx)
        {
            if (this.Disposing)
            {
                return;
            }
            var pn = new TableLayoutPanel {
                AutoSize = true, ColumnCount = 3, Margin = new Padding(0)
            };

            var hll = new HoverLinkLabel(TopLevelForm);

            SetLabelProperties(hll, item.FIO);
            hll.Caption = string.Format("№{0} {1}", item.Employee, hll.Text);
            hll.Url     = Environment.UsersURL + item.Employee;
            pn.Controls.Add(hll, 2, 0);

            var lb = new Label();

            SetLabelProperties(lb, "/");
            lb.TextAlign = ContentAlignment.MiddleCenter;
            lb.Margin    = new Padding(0);
            pn.Controls.Add(lb, 1, 0);

            var hll4 = new HoverLinkLabel(TopLevelForm);

            SetLabelProperties(hll4, item.FIO4);
            hll4.Margin  = new Padding(hll.Margin.Left, 0, 0, 0);
            hll4.Caption = string.Format("№{0} {1}", item.Employee4, hll4.Text);
            hll4.Url     = Environment.UsersURL + item.Employee4;
            pn.Controls.Add(hll4, 0, 0);

            tableLayoutPanel.Controls.Add(pn, SURNAME_COLUMN_IDX, rowIdx);
        }
Example #4
0
    public void UpdateSignUI(int start, int end)
    {
        int day = 0;

        //假设某月第一天为星期六,共有30天
        //则下标从5之前置空,6-35显示日期

        //将之前的置空
        for (int i = 0; i < start; ++i)
        {
            GameObject temp = Instantiate(signItemPrefab);
            temp.transform.SetParent(signItemParent);
            temp.transform.localPosition = Vector3.zero;
            temp.transform.localScale    = Vector3.one;

            temp.GetComponent <SignItemUI>().Hide();
        }

        //显示日期
        for (int i = start; i < end; ++i)
        {
            GameObject temp = Instantiate(signItemPrefab);
            temp.transform.SetParent(signItemParent);
            temp.transform.localPosition = Vector3.zero;
            temp.transform.localScale    = Vector3.one;

            temp.GetComponent <SignItemUI>().UpdateDay(++day);

            SignItem item = new SignItem(day, false);  //构造item,存储信息
            itemDict.Add(day, item);
            itemUIDict.Add(day, temp.GetComponent <SignItemUI>());
        }
    }
 public static void StoreSignItem(int day, SignItem item)
 {
     if (gridItem.ContainsKey(day))
     {
         RemoveSignItem(day);
     }
     gridItem.Add(day, item);
 }
Example #6
0
 public void SetItemValue(object obj)
 {
     itemValue = obj as SignItem;
     giftNum   = itemValue.num;
     id        = itemValue.pid;
     myName    = this.GetGiftName();
     canClick  = true;
     this.Refresh();
 }
    /// <summary>
    /// 返回正常签到
    /// </summary>
    public void BackUINormalSignDay(SignDayResponse resp)
    {
        ItemList [signtms].curSignItem = DateSignItem.SignItemState.isSigned;
        ItemList [signtms].Refresh();
        SignItem tItem = (SignItem)ItemList [signtms].ReturnValue();

        canClick = true;
        this.ShowGetGift(tItem, resp.data.p);
        signtms++;
        this.Refresh();
    }
Example #8
0
        private void AddSimpleSurnameRow(SignItem item, int rowIdx)
        {
            if (this.Disposing)
            {
                return;
            }
            var hll = new HoverLinkLabel(TopLevelForm);

            SetLabelProperties(hll, item.FIO);
            hll.Caption = string.Format("№{0} {1}", item.Employee, hll.Text);
            hll.Url     = Environment.UsersURL + item.Employee;
            tableLayoutPanel.Controls.Add(hll, SURNAME_COLUMN_IDX, rowIdx);
        }
    /// <summary>
    /// 展示签到成功
    /// </summary>
    public void ShowGetGift(SignItem Reward, ItemOfReward[] tIOR)
    {
        if (Core.Data.playerManager.curVipLv >= Reward.vip && Reward.vip != 0)
        {
            // Dictionary<int,int> pidList = new  Dictionary<int, int>();
            //分析  分成两部分 给奖励 主要为了 vip展示
//            for (int i = 0; i < tIOR.Length; i++) {
//                if (pidList.ContainsKey (tIOR [i].pid))
//                    pidList [tIOR [i].pid]+= tIOR[i].num;
//                else
//                    pidList.Add (tIOR [i].pid, tIOR[i].num);
//            }
//
//            ItemOfReward[] tIor = null;
//            foreach(int pair in pidList.Keys){
//
//                ItemOfReward iRe = new ItemOfReward ();
//                iRe.pid = pair;
//                if (pidList.TryGetValue (iRe.pid, out iRe.num)) {
//                    iRe.num = iRe.num / 2;
//                }
//                tIor = new ItemOfReward[]{ iRe, iRe };
//
//            }
//            Debug.Log (" item  num " + tIor.Length  );
            ItemOfReward item = new ItemOfReward();
            if (tIOR != null)
            {
                item     = tIOR [0];
                item.num = tIOR [0].num / 2;
            }

            ItemOfReward[] result = new ItemOfReward[] { item, item };
            GetRewardSucUI.OpenUI(result, Core.Data.stringManager.getString(5047), false);
        }
        else
        {
            GetRewardSucUI.OpenUI(tIOR, Core.Data.stringManager.getString(5047));
        }
//		UIActivityReward ar = WXLLoadPrefab.GetPrefabClass<UIActivityReward>();
//		if(ar != null)
//		{
//			Transform t = ar.transform;
//			t.parent = transform;
//			t.localPosition = Vector3.back;
//			t.localRotation = Quaternion.identity;
//			t.localScale = Vector3.one;
//
//		}
    }
        public SignItem GetSignItem(IAlipayRequest <T> request, string responseBody)
        {
            if (string.IsNullOrEmpty(responseBody))
            {
                return(null);
            }

            var signItem = new SignItem()
            {
                Sign           = GetSign(responseBody),
                SignSourceDate = GetSignSourceData(request, responseBody)
            };

            return(signItem);
        }
Example #11
0
        public SignItem GetSignItem(IRequest <T> request, string responseBody)
        {
            if (string.IsNullOrEmpty(responseBody))
            {
                return(null);
            }

            SignItem signItem = Newtonsoft.Json.JsonConvert.DeserializeObject <SignItem>(responseBody);

            string signSourceData = GetSignSourceData(request, responseBody);

            signItem.SignSourceDate = signSourceData;

            return(signItem);
        }
    /// <summary>
    /// 补签 成功 返回
    /// </summary>
    public void BackBuQian(SignDayResponse resp)
    {
        DateSignItem tItemData = null;

        tItemData             = ItemList [signtms];
        tItemData.curSignItem = DateSignItem.SignItemState.isSigned;
        tItemData.Refresh();
        SignItem tItem = tItemData.itemValue;

        canClick = true;
        pairtms++;
        signtms++;

        this.ShowGetGift(tItem, resp.data.p);

        this.Refresh();
    }
Example #13
0
        public SignItem GetSignItem(IAopRequest <T> request, string responseBody)
        {
            if (string.IsNullOrEmpty(responseBody))
            {
                return(null);
            }

            var signItem = new SignItem();
            var sign     = GetSign(responseBody);

            signItem.Sign = sign;

            var signSourceData = GetSignSourceData(request, responseBody);

            signItem.SignSourceDate = signSourceData;

            return(signItem);
        }
Example #14
0
        /// <summary>
        /// Удаление подписи
        /// </summary>
        /// <param name="item"></param>
        private void DeleteSignItem(SignItem item)
        {
            if (Environment.DocSignatureData.Delete(item.SignId))
            {
                // в стек UNDO помещаем свои подписи, на востанавление чужих подписей может не хватить прав
                if (Environment.CurEmp.ID == item.Employee)
                {
                    UndoRemoveSign(item.SignId, _docId, true, _imgId, item.Employee, (byte)item.SignType);
                }

                if (item.SignType == SignType.stampSign)
                {
                    OnNeedRefreshStamp();
                }
                LoadDocInfo(_docId, _imgId);
                OnRemovedDocSign();
            }
        }
Example #15
0
        object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
        {
            if (hitInfo == null || entity == null)
            {
                return(null);
            }

            BasePlayer player = hitInfo.Initiator as BasePlayer;
            Signage    sign   = entity as Signage;

            if (player && sign && m_signsShowInfo.Contains(player.userID))
            {
                if (player.net.connection.authLevel == 0 && !permission.UserHasPermission(player.userID.ToString(), "SSNSigns.signs"))
                {
                    return(null);
                }

                uint signId = sign.net.ID;

                player.ChatMessage("Sign: <color=cyan>" + signId + "</color>");

                if (m_signsLogs.SignItems.ContainsKey(signId))
                {
                    List <ulong> contextPlayers = new List <ulong>();
                    SignItem     signItem       = m_signsLogs.SignItems[signId];
                    int          i = 0;
                    foreach (ulong userID in sortedByDatetime(signItem.AccessItems))
                    {
                        contextPlayers.Add(userID);

                        AccessItem accessItem = m_signsLogs.SignItems[signId].AccessItems[userID];

                        string message = m_configData.Messages["player_access"];
                        message = message.Replace("%player_steamid", userID.ToString());
                        message = message.Replace("%player_name", SSNNotifier.Call <string>("PlayerName", userID));
                        message = message.Replace("%timestamp", accessItem.dateTime);
                        player.ChatMessage((++i).ToString() + ") " + message);
                    }
                    SSNNotifier.Call("SetContextPlayers", player.userID, contextPlayers);
                }
                return("handled");
            }
            return(null);
        }
Example #16
0
        private void AddRow(SignItem item, int rowIdx)
        {
            if (this.Disposing)
            {
                return;
            }
            Label lb = null;

            if (rowIdx == 0)
            {
                lb = tableLayoutPanel.GetControlFromPosition(LABEL_COLUMN_IDX, 0) as Label;
            }
            if (lb == null)
            {
                lb = new Label();
            }

            SetLabelProperties(lb, item.SignText);
            if (rowIdx > 0)
            {
                tableLayoutPanel.Controls.Add(lb, LABEL_COLUMN_IDX, rowIdx);
            }

            if (item.Employee != item.Employee4)
            {
                AddCustomSurnameRow(item, rowIdx);
            }
            else
            {
                AddSimpleSurnameRow(item, rowIdx);
            }

            var dateLabel = new Label();

            SetLabelProperties(dateLabel, GetLocalDateTime(item.Date));
            tableLayoutPanel.Controls.Add(dateLabel, DATE_COLUMN_IDX, rowIdx);

            if (item.CanRemove)
            {
                AddRemovePicture(item, rowIdx);
            }
        }
Example #17
0
        private PictureBox AddRemovePicture(SignItem item, int rowIdx)
        {
            if (this.Disposing || imageList.Images.Count < 1)
            {
                return(null);
            }
            PictureBox pb = new PictureBox
            {
                SizeMode = PictureBoxSizeMode.AutoSize,
                Cursor   = Cursors.Hand,
                Image    = imageList.Images[0],
                Margin   = new Padding(0),
                Tag      = item
            };

            pb.Click += RemoveControl_Click;

            tableLayoutPanel.Controls.Add(pb, REMOVE_COLUMN_IDX, rowIdx);

            return(pb);
        }
Example #18
0
        public void should_extract_correct_source_data_and_sign()
        {
            AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
            String responseBody = "{\"alipay_trade_create_response\":{\"code\":\"10000\",\"msg\":\"Success\","
                                  + "\"out_trade_no\":\"20150320010101001\",\"trade_no\":\"2019062322001446881000041395\"},"
                                  + "\"sign\":\"TS355N0QjK1r9GyD4YOsG5esszSUhESgwu1q5"
                                  + "+e1sWwqtPYe30CQ3v0QTEDdxYN9vm2No8V1KzuTSadrA4SZSkEkRchrcdVHCU8rCXOHWzS5wof8jg5S75y481kj3HqlpTaz"
                                  + "/EhvAXK8iC8Xz9CgPmvfLmAUNkxy0q05yV2wZAGNX0WElUOx1Lcd2FqeuRFMvBOq5TQ+SVqunfUMLic8rYsW"
                                  + "+smDHzIgjRcde8pHOZBMvmqDDzmyBLEgSbBswgHifQPDrhnGPlpk2U/nb8Sx7G8mWHEibtb8ClENcxtJEwcI0NN+erWO4Le"
                                  + "+jFVUOU0BqC4dxGBNX9AHCTZMEhfcZQ==\"}";

            SignItem signItem = JsonParser.GetSignItem(request, responseBody);

            Assert.AreEqual(signItem.SignSourceDate, "{\"code\":\"10000\",\"msg\":\"Success\",\"out_trade_no\":\"20150320010101001\","
                            + "\"trade_no\":\"2019062322001446881000041395\"}");
            Assert.AreEqual(signItem.Sign, "TS355N0QjK1r9GyD4YOsG5esszSUhESgwu1q5"
                            + "+e1sWwqtPYe30CQ3v0QTEDdxYN9vm2No8V1KzuTSadrA4SZSkEkRchrcdVHCU8rCXOHWzS5wof8jg5S75y481kj3HqlpTaz"
                            + "/EhvAXK8iC8Xz9CgPmvfLmAUNkxy0q05yV2wZAGNX0WElUOx1Lcd2FqeuRFMvBOq5TQ+SVqunfUMLic8rYsW"
                            + "+smDHzIgjRcde8pHOZBMvmqDDzmyBLEgSbBswgHifQPDrhnGPlpk2U/nb8Sx7G8mWHEibtb8ClENcxtJEwcI0NN+erWO4Le"
                            + "+jFVUOU0BqC4dxGBNX9AHCTZMEhfcZQ==");
        }
Example #19
0
        private void AddSignItem(Contract contract, KeyPair key)
        {
            if (!Tx.GetScriptHashesForVerifying(null).Contains(contract.ScriptHash))
            {
                throw new Exception($"Add SignItem error: Mismatch ScriptHash ({contract.ScriptHash})");
            }

            SignItem item = signStore.FirstOrDefault(p => p.Contract.ScriptHash == contract.ScriptHash);

            if (item is null)
            {
                signStore.Add(new SignItem {
                    Contract = contract, KeyPairs = new HashSet <KeyPair> {
                        key
                    }
                });
            }
            else if (!item.KeyPairs.Contains(key))
            {
                item.KeyPairs.Add(key);
            }
        }
Example #20
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="request"></param>
        /// <param name="responseBody"></param>
        /// <param name="isError"></param>
        /// <param name="parser"></param>
        private void CheckResponseSign <T>(IAopRequest <T> request, string responseBody, bool isError, IAopParser <T> parser) where T : AopResponse
        {
            if (string.IsNullOrEmpty(alipayPublicKey) || string.IsNullOrEmpty(charset))
            {
                return;
            }

            SignItem signItem = parser.GetSignItem(request, responseBody);

            if (signItem == null)
            {
                throw new Exception("sign check fail: Body is Empty!");
            }

            if (!isError ||
                (isError && !string.IsNullOrEmpty(signItem.Sign)))
            {
                bool rsaCheckContent = AlipaySignature.RSACheckContent(signItem.SignSourceDate, signItem.Sign, alipayPublicKey, charset, signType, keyFromFile);
                if (!rsaCheckContent)
                {
                    if (!string.IsNullOrEmpty(signItem.SignSourceDate) && signItem.SignSourceDate.Contains("\\/"))
                    {
                        string srouceData = signItem.SignSourceDate.Replace("\\/", "/");
                        bool   jsonCheck  = AlipaySignature.RSACheckContent(srouceData, signItem.Sign, alipayPublicKey, charset, signType, keyFromFile);
                        if (!jsonCheck)
                        {
                            throw new Exception(
                                      "sign check fail: check Sign and Data Fail JSON also");
                        }
                    }
                    else
                    {
                        throw new Exception(
                                  "sign check fail: check Sign and Data Fail!");
                    }
                }
            }
        }
Example #21
0
        public SignItem[] GetDocumentSigns(int docId, int?imageId, out bool canSign, out bool canFinalSign, out bool canSingCancel, CancellationToken token)
        {
            var result = new List <SignItem>();

            canSign = canFinalSign = canSingCancel = false;
            using (var conn = new SqlConnection(connectionString))
                using (var cmd = new SqlCommand("dbo.sp_ПодписиДокумента", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    if (token != CancellationToken.None)
                    {
                        token.Register(() => cmd.Cancel());
                    }
                    conn.Open();
                    AddParam(cmd, "@КодДокумента", SqlDbType.Int, docId);
                    if (imageId.HasValue)
                    {
                        AddParam(cmd, "@КодИзображениядокумента", SqlDbType.Int, imageId.Value);
                    }

                    SqlParameter canWrite = AddParam(cmd, "@МожноПодписать", SqlDbType.SmallInt, null);
                    canWrite.Direction = ParameterDirection.Output;

                    try
                    {
                        using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                        {
                            while (reader.Read())
                            {
                                var item = new SignItem(reader, this);
                                result.Add(item);
                            }
                            reader.Close();
                        }

                        if (token.IsCancellationRequested)
                        {
                            token.ThrowIfCancellationRequested();
                        }
                        canSign       = (Int16)canWrite.Value > -1;
                        canFinalSign  = canWrite.Value.Equals((Int16)1);
                        canSingCancel = canWrite.Value.Equals((Int16)2);
                    }
                    catch (SqlException ex)
                    {
                        if (!token.IsCancellationRequested)
                        {
                            ProcessSqlEx(ex, cmd);
                        }
                    }
                    catch (Exception ex)
                    {
                        if (!token.IsCancellationRequested)
                        {
                            ErrorMessage(ex, cmd, "GetDocumentSigns");
                        }
                    }
                }
            if (token.IsCancellationRequested)
            {
                token.ThrowIfCancellationRequested();
            }
            return(result.ToArray());
        }
    private void Update()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("WeeklySignScript_hotfix", "Update"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.WeeklySignScript_hotfix", "Update", null, null);
            return;
        }

        //签到成功后,做的一些ui操作
        if (isSignSuccess)
        {
            GameObject signObject = signObjects[totalSignDays];
            var        name       = signObject.transform.GetChild(2);
            Transform  image_lingqu;
            if (SignData.SignWeekDays == 6)
            {
                image_lingqu = signObject.transform.GetChild(3);
            }
            else
            {
                image_lingqu = signObject.transform.GetChild(4);
            }
            //            var image_prop = signObject.transform.GetChild(2);
            var guang = signObject.transform.GetChild(0);
            //取消点击事件
            signObject.GetComponent <Button>().enabled = false;

            //取消光
//            Transform child = guang.transform.GetChild(0);
//
//            Destroy(child.gameObject);

//            Color color = signObject.GetComponent<Image>().color;
//            color.r = 0.5f;
//            color.g = 0.5f;
//            color.b = 0.5f;
//            name.GetComponent<Text>().color = color;
//            image_prop.GetComponent<Image>().color = color;
//            signObject.GetComponent<Image>().color = color;

//            go.transform.localScale = Vector3.zero;

            image_lingqu.transform.localScale = Vector3.one;
            btn_Sign.transform.localScale     = Vector3.zero;
            image_Signed.transform.localScale = Vector3.one;

            if (SignData.SignWeekDays == 6)
            {
                signObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Sign/item_bg_big2");
            }
            else
            {
                signObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Sign/item_bg_smail2");
            }

            SignData.IsSign = true;
            SignData.SignWeekDays++;
            isSignSuccess = false;

            SignItem signItem = _signItems[totalSignDays];
            LogUtil.Log(signItem.goods_prop);
            AddProp(signItem.goods_prop);

            //ShowRewardPanelScript.create().GetComponent<ShowRewardPanelScript>().setData(signItem.goods_prop);
            ShowRewardPanelScript.Show(signItem.goods_prop, false);

            if (OtherData.s_mainScript != null)
            {
                OtherData.s_mainScript.checkRedPoint();
            }
        }
    }
Example #23
0
        private void DrawSignsItems(bool needRefresh, CancellationToken ct)
        {
            lock (this)
            {
                if (ct != CancellationToken.None && ct.IsCancellationRequested)
                {
                    return;
                }
                SuspendLayout();
                tableLayoutPanel.SuspendLayout();
                try
                {
                    if (items != null && items.Count > 0)
                    {
                        if (ct != CancellationToken.None && ct.IsCancellationRequested)
                        {
                            return;
                        }
                        SignItem last = items[items.Count - 1];
                        IsFinalSign = last.SignType != SignType.firstSign;

                        llSign.Visible      = _canSign;
                        llFinalSign.Visible = _canFinalSign;
                        lLCancel.Visible    = _canSignCancel;

                        //Число уменьшилось или осталось темже
                        if (items.Count <= _rowCount)
                        {
                            if (ct != CancellationToken.None && ct.IsCancellationRequested)
                            {
                                return;
                            }
                            if (items.Count < _rowCount)
                            {
                                ClearPanelControls(items.Count);
                            }

                            for (int row = 0; row < items.Count; row++)
                            {
                                try
                                {
                                    if (ct != CancellationToken.None && ct.IsCancellationRequested)
                                    {
                                        return;
                                    }
                                    UpdateRow(items[row], row);
                                }
                                catch (NullReferenceException)
                                {
                                }
                            }
                        }
                        //Число увеличилось
                        else
                        {
                            if (ct != CancellationToken.None && ct.IsCancellationRequested)
                            {
                                return;
                            }
                            tableLayoutPanel.RowCount = items.Count;

                            for (int row = 0; row < _rowCount; row++)
                            {
                                try
                                {
                                    if (ct.IsCancellationRequested)
                                    {
                                        return;
                                    }
                                    UpdateRow(items[row], row);
                                }
                                catch (NullReferenceException)
                                {
                                }
                            }

                            for (int row = _rowCount; row < items.Count; row++)
                            {
                                if (ct != CancellationToken.None && ct.IsCancellationRequested)
                                {
                                    return;
                                }
                                AddRow(items[row], row);
                            }
                        }

                        _rowCount = items.Count;
                    }
                }
                catch (Exception ex)
                {
                    Data.Env.WriteToLog(ex);
                    Error.ErrorShower.OnShowError(null, ex.Message, "");
                }
                finally
                {
                    tableLayoutPanel.ResumeLayout();
                    ResumeLayout(true);
                    tableLayoutPanel.Left = ClientSize.Width - tableLayoutPanel.Width;
                    UpdateLinksLocation();
                }
                if (ct != CancellationToken.None && ct.IsCancellationRequested)
                {
                    return;
                }
                if (items != null && items.Count > 0)
                {
                    if (!tableLayoutPanel.Visible)
                    {
                        tableLayoutPanel.Visible = true;
                    }
                }
                else
                {
                    ClearPanelControls(0);
                    tableLayoutPanel.Visible = false;

                    llSign.Visible      = _canSign;
                    llFinalSign.Visible = _canFinalSign;
                    lLCancel.Visible    = _canSignCancel;
                }
            }
        }
Example #24
0
        private void UpdateRow(SignItem item, int rowIdx)
        {
            if (item == null || tableLayoutPanel == null || this.Disposing)
            {
                return;
            }
            Label lb;

            if (rowIdx == 0)
            {
                lb = (Label)tableLayoutPanel.GetControlFromPosition(LABEL_COLUMN_IDX, 0);
            }
            else
            {
                lb = (Label)tableLayoutPanel.GetControlFromPosition(LABEL_COLUMN_IDX, rowIdx);
            }
            if (lb == null)
            {
                lb = new Label();

                tableLayoutPanel.Controls.Add(lb, LABEL_COLUMN_IDX, rowIdx);
            }

            SetLabelProperties(lb, item.SignText);

            System.Windows.Forms.Control ctrl = tableLayoutPanel.GetControlFromPosition(SURNAME_COLUMN_IDX, rowIdx);
            if (ctrl is TableLayoutPanel)
            {
                var pn = (TableLayoutPanel)ctrl;
                if (item.Employee != item.Employee4)
                {
                    var hll = (HoverLinkLabel)pn.GetControlFromPosition(0, 0);
                    hll.Url     = Environment.UsersURL + item.Employee4;
                    hll.Text    = item.FIO4;
                    hll.Caption = string.Format("№{0} {1}", item.Employee4, hll.Text);

                    var hll2 = (HoverLinkLabel)pn.GetControlFromPosition(2, 0);
                    hll2.Url     = Environment.UsersURL + item.Employee;
                    hll2.Text    = item.FIO;
                    hll2.Caption = string.Format("№{0} {1}", item.Employee, hll2.Text);
                }
                else
                {
                    ClearTableLayoutTable(pn);
                    tableLayoutPanel.Controls.Remove(pn);
                    AddSimpleSurnameRow(item, rowIdx);
                }
            }
            else
            {
                if (item.Employee != item.Employee4)
                {
                    tableLayoutPanel.Controls.Remove(ctrl);
                    AddCustomSurnameRow(item, rowIdx);
                }
                else
                {
                    var hll = (HoverLinkLabel)ctrl;
                    hll.Url     = Environment.UsersURL + item.Employee;
                    hll.Text    = item.FIO;
                    hll.Caption = string.Format("№{0} {1}", item.Employee, hll.Text);
                }
            }

            var date = (Label)tableLayoutPanel.GetControlFromPosition(DATE_COLUMN_IDX, rowIdx);

            if (date != null)
            {
                date.Text = GetLocalDateTime(item.Date);
            }

            var pb = (PictureBox)tableLayoutPanel.GetControlFromPosition(REMOVE_COLUMN_IDX, rowIdx);

            if (pb == null)
            {
                if (item.CanRemove)
                {
                    AddRemovePicture(item, rowIdx);
                }
            }
            else
            {
                if (item.CanRemove)
                {
                    pb.Tag = item;
                }
                else
                {
                    pb.Click -= RemoveControl_Click;
                    tableLayoutPanel.Controls.Remove(pb);
                }
            }
        }
    /// <summary>
    /// 初始化ui
    /// </summary>
    public void InitUi()
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("WeeklySignScript_hotfix", "InitUi"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.WeeklySignScript_hotfix", "InitUi", null, null);
            return;
        }

        //签到过,按钮不可点击
        if (SignData.IsSign)
        {
            btn_Sign.transform.localScale     = Vector3.zero;
            image_Signed.transform.localScale = Vector3.one;
        }
        for (int i = 0; i < signObjects.Count; i++)
        {
            GameObject Object   = signObjects[i];
            SignItem   signItem = _signItems[i];


            var name         = Object.transform.GetChild(2);
            var image_lingqu = Object.transform.GetChild(4);
            var image_prop   = Object.transform.GetChild(3);
            var guang        = Object.transform.GetChild(0);


            //设置元宝等道具
            Text text1 = name.GetComponent <Text>();
            text1.text = signItem.goods_name;
            var prop = image_prop.GetComponent <Image>();
            if (i == 6)
            {
                var obj = Resources.Load <GameObject>("Prefabs/UI/Item/Item_sign_dalibao");
                Object.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Sign/item_bg_big2");
                Instantiate(obj, guang.transform);
                Destroy(prop.gameObject);
            }
            else
            {
                Object.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Sign/item_bg_smail2");
                prop.sprite = Resources.Load <Sprite>("Sprites/Icon/Prop/" + signItem.goods_icon);
            }

            //未签到
            if (SignData.IsSign == false)
            {
                if (i < totalSignDays)
                {
//                    Color color = Object.GetComponent<Image>().color;
//                    color.r = 0.5f;
//                    color.g = 0.5f;
//                    color.b = 0.5f;
//                    Object.GetComponent<Image>().color = color;
//                    text1.color = color;
//                    prop.color = color;

                    image_lingqu.transform.localScale = Vector3.one;
                }
                else
                {
                    image_lingqu.transform.localScale = Vector3.zero;
                }
                if (totalSignDays == i)
                {
                    if (i == 6)
                    {
                        Object.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Sign/Item_bg_current_big");
                    }
                    else
                    {
                        Object.GetComponent <Image>().sprite = Resources.Load <Sprite>("Sprites/Sign/item_bg_current_smail");
                    }
                    //发光
//                    go = Resources.Load<GameObject>("Prefabs/UI/Other/Sign_guang");
//                    go.transform.localScale = Vector3.one;
//                    GameObject.Instantiate(go, guang.transform);
                    Button button = Object.AddComponent <Button>();
                    button.onClick.RemoveAllListeners();
                    button.onClick.AddListener(() =>
                    {
                        //发送 签到请求
                        LogicEnginerScript.Instance.GetComponent <SignRequest>().CallBack = SignCallBack;
                        LogicEnginerScript.Instance.GetComponent <SignRequest>().OnRequest();
                    });
//                    Object.GetComponent<Image>().color = new Color(1, 185/(float)255,0,1);
                }
            }
            //已签到
            else
            {
                if (i < totalSignDays)
                {
//                    Color color = Object.GetComponent<Image>().color;
//                    color.r = 0.5f;
//                    color.g = 0.5f;
//                    color.b = 0.5f;
//                    Object.GetComponent<Image>().color = color;
//                    text1.color = color;
//                    prop.color = color;
                    image_lingqu.transform.localScale = Vector3.one;
                }
                else
                {
                    image_lingqu.transform.localScale = Vector3.zero;
                }
            }
        }
    }