예제 #1
0
    /// <summary>
    /// 插入数据
    /// </summary>
    /// <param name="tableName"></param>
    /// <param name="itemData"></param>
    public bool BaseInsertData <T>(string tableName, T itemData)
    {
        //插入数据
        Dictionary <string, object> mapData = ReflexUtil.GetAllNameAndValue(itemData);
        List <string> listKeys   = new List <string>();
        List <string> listValues = new List <string>();

        foreach (var item in mapData)
        {
            string itemKey  = item.Key;
            string valueStr = Convert.ToString(item.Value);
            listKeys.Add(item.Key);
            if (item.Value == null)
            {
                listValues.Add("null");
            }
            else if (item.Value is string)
            {
                if (CheckUtil.StringIsNull(valueStr))
                {
                    listValues.Add("null");
                }
                else
                {
                    listValues.Add("'" + valueStr + "'");
                }
            }
            else
            {
                listValues.Add(valueStr);
            }
        }
        return(SQLiteHandle.InsertValues(ProjectConfigInfo.DATA_BASE_INFO_NAME, tableName, TypeConversionUtil.ListToArray(listKeys), TypeConversionUtil.ListToArray(listValues)));
    }
예제 #2
0
    /// <summary>
    /// 开始制造麻烦
    /// </summary>
    /// <returns></returns>
    public IEnumerator CoroutineForStartMakeTrouble()
    {
        while (rascalIntent == RascalIntentEnum.MakeTrouble || rascalIntent == RascalIntentEnum.ContinueMakeTrouble)
        {
            if (isMove)
            {
                movePosition = InnHandler.Instance.GetRandomInnPositon();
                bool canGo = CheckUtil.CheckPath(transform.position, movePosition);
                if (canGo)
                {
                    characterMoveCpt.SetDestination(movePosition);
                }
            }
            //随机获取一句喊话
            //int shoutId = Random.Range(13101, 13106);
            if (!CheckUtil.ListIsNull(listShoutTextInfo))
            {
                TextInfoBean textInfo = RandomUtil.GetRandomDataByList(listShoutTextInfo);
                characterShoutCpt.Shout(textInfo.content);
            }
            yield return(new WaitForSeconds(5));

            //时间到了就离开
            timeMakeTrouble -= 5;
            if (timeMakeTrouble <= 0)
            {
                SetIntent(RascalIntentEnum.Leave);
            }
        }
    }
예제 #3
0
        public DbCommand GetStoredProcCommandWithSourceColumns(string storedProcedureName, params string[] sourceColumns)
        {
            CheckUtil.ArgumentNotNullOrEmpty(storedProcedureName, "storedProcedureName");
            if (sourceColumns == null)
            {
                throw new ArgumentNullException("sourceColumns");
            }

            DbCommand dbCommand = GetStoredProcCommand(storedProcedureName);

            using (DbConnection connection = CreateConnection())
            {
                dbCommand.Connection = connection;
                DiscoverParameters(dbCommand);
            }

            int iSourceIndex = 0;

            foreach (IDataParameter dbParam in dbCommand.Parameters)
            {
                if ((dbParam.Direction == ParameterDirection.Input) | (dbParam.Direction == ParameterDirection.InputOutput))
                {
                    dbParam.SourceColumn = sourceColumns[iSourceIndex];
                    iSourceIndex++;
                }
            }

            return(dbCommand);
        }
예제 #4
0
    protected void ChangeCharacter(int number)
    {
        if (CheckUtil.ListIsNull(listCharacter))
        {
            return;
        }
        int nextPosition = 0;

        for (int i = 0; i < listCharacter.Count; i++)
        {
            CharacterBean itemCharater = listCharacter[i];
            if (itemCharater == characterData)
            {
                nextPosition = i + number;
                if (nextPosition >= listCharacter.Count)
                {
                    nextPosition = nextPosition - listCharacter.Count;
                }
                else if (nextPosition < 0)
                {
                    nextPosition = listCharacter.Count + nextPosition;
                }
                break;
            }
        }
        SetCharacterData(listCharacter, listCharacter[nextPosition]);
        RefreshUI();
    }
예제 #5
0
        public void LoadConfig(TargetConfig config)
        {
            CheckUtil.ArgumentNotNull(config, "config");

            Name = config.Name;
            foreach (XmlNode node in config.ChildConfig)
            {
                try
                {
                    if (node.ChildNodes.Count != 1)
                    {
                        throw new ConfigurationErrorsException("DbTarget子元素 " + node.Name + "只能为单值元素");
                    }

                    switch (node.Name)
                    {
                    case "connectionStringName":
                        ConnectionStringName = node.FirstChild.Value;
                        break;

                    case "commandText":
                        CommandText = node.FirstChild.Value;
                        break;
                    }
                }
                catch (FormatException ex)
                {
                    throw new ConfigurationErrorsException("解析DbTarget子元素值 '" + node.FirstChild.Value + "'失败", ex);
                }
            }
        }
예제 #6
0
        /// <summary>
        /// 计算字符串的哈希值
        /// </summary>
        /// <param name="s"></param>
        /// <param name="hashAlgorithmType"></param>
        /// <param name="encoding">指定字符串的编码</param>
        /// <returns></returns>
        public static byte[] GetHash(string s, HashAlgorithmType hashAlgorithmType, Encoding encoding)
        {
            CheckUtil.ArgumentNotNullOrEmpty(s, "s");

            byte[] data = encoding.GetBytes(s);
            return(GetHash(data, hashAlgorithmType));
        }
예제 #7
0
 /// <summary>
 /// 还贷
 /// </summary>
 /// <returns></returns>
 public void PayLoans(out List <UserLoansBean> listPayLoans)
 {
     listPayLoans = new List <UserLoansBean>();
     if (CheckUtil.ListIsNull(listLoans))
     {
         return;
     }
     for (int i = 0; i < listLoans.Count; i++)
     {
         UserLoansBean itemLoans = listLoans[i];
         if (HasEnoughMoney(0, 0, itemLoans.moneySForDay))
         {
             //支付金钱
             PayMoney(0, 0, itemLoans.moneySForDay);
             //剩余的还贷日期-1
             itemLoans.residueDays -= 1;
             //已经还过的列表+1
             listPayLoans.Add(itemLoans);
             //如果已经还完
             if (itemLoans.residueDays <= 0)
             {
                 listLoans.Remove(itemLoans);
                 i--;
             }
         }
     }
 }
예제 #8
0
        /// <summary>
        /// 加载配置
        /// </summary>
        /// <param name="config"></param>
        /// <exception cref="InvalidOperationException">配置已经被加载</exception>
        /// <exception cref="ArgumentNullException">参数<c>config</c> 不能为空</exception>
        /// <exception cref="ConfigurationErrorsException">配置无法正确加载</exception>
        public void LoadConfig(TargetConfig config)
        {
            CheckUtil.ArgumentNotNull(config, "config");

            this.Name = config.Name;
            foreach (XmlNode node in config.ChildConfig)
            {
                try
                {
                    if (node.ChildNodes.Count != 1)
                    {
                        throw new ConfigurationErrorsException("RemotingTarget子元素 " + node.Name + "只能为单值元素");
                    }

                    switch (node.Name)
                    {
                    case "clientName":
                        ClientName = node.FirstChild.Value;
                        break;

                    case "appName":
                        AppName = node.FirstChild.Value;
                        break;

                    default: break;
                    }
                }
                catch (FormatException ex)
                {
                    throw new ConfigurationErrorsException("解析RemotingTarget子元素值 '" + node.FirstChild.Value + "'失败", ex);
                }
            }
        }
예제 #9
0
        /// <summary>省略の文字列を取得</summary>
        /// <param name="input">入力文字列</param>
        /// <param name="maxByteLen">最大のバイト数</param>
        /// <returns></returns>
        public static String GetOmitString(String input, int maxByteLen)
        {
            // 変換対象文字列のバイト数を求める

            int inputByteLength = CheckUtil.Get_ByteLength(input);

            // 変換対象のバイト数が、保持するバイト数以内に
            // 収まっている場合は、そのままの文字列を返す
            if (inputByteLength <= maxByteLen)
            {
                return(input);
            }
            // 保持バイト長
            int keepByteLength = maxByteLen - 3;

            // バイト変換した文字列の桁数が、指定バイト数を上回る箇所を判定

            for (int i = 0; i <= input.Length; i++)
            {
                int checkStrByteLength = CheckUtil.Get_ByteLength(input.Substring(0, i));

                if (keepByteLength < checkStrByteLength)
                {
                    // 変換文字のバイト数が指定バイト数を上回る位置に来たら、
                    // その手前までの文字列(+略号)を返す
                    return(input.Substring(0, i - 1) + SystemConst.SUFFIX_JOB);
                }
            }
            return(input);
        }
예제 #10
0
        /// <summary> 値のセットと表示処理</summary>
        /// <param name="sender">源</param>
        private void SetValues(string jobId)
        {
            // ジョブ管理テーブルのデータを取得
            DataRow[] rowJob = _myJob.Container.JobControlTable.Select("job_id='" + jobId + "'");
            if (rowJob != null && rowJob.Length > 0)
            {
                txtJobId.Text   = jobId;
                txtJobName.Text = Convert.ToString(rowJob[0]["job_name"]);
            }

            // 計算アイコン設定テーブルのデータを取得
            DataRow[] rowCal;
            if (_myJob.ContentItem.InnerJobId == null)
            {
                rowCal = _myJob.Container.IconCalcTable.Select("job_id='" + jobId + "'");
            }
            else
            {
                rowCal = _myJob.Container.IconCalcTable.Select("inner_job_id=" + _myJob.ContentItem.InnerJobId);
            }
            if (rowCal != null && rowCal.Length > 0)
            {
                string handFlag = Convert.ToString(rowCal[0]["hand_flag"]);
                if (CheckUtil.IsNullOrEmpty(handFlag) || "0".Equals(handFlag))
                {
                    rbInteger.IsChecked = true;
                }
                else
                {
                    rbTime.IsChecked = true;
                }
                txtFormula.Text   = Convert.ToString(rowCal[0]["formula"]);
                txtValueName.Text = Convert.ToString(rowCal[0]["value_name"]);
            }
        }
예제 #11
0
    /// <summary>
    /// 前置条件UI
    /// </summary>
    /// <param name="storeInfo"></param>
    private void GUITriggerCondition(StoryInfoBean storyInfo)
    {
        //前置相关
        EditorGUILayout.BeginVertical();
        EditorUI.GUIText("触发条件:", 100, 20);
        if (EditorUI.GUIButton("添加条件", 100, 20))
        {
            storyInfo.trigger_condition += ("|" + EnumUtil.GetEnumName(EventTriggerEnum.Year) + ":" + "1|");
        }
        List <string> listTriggerData = StringUtil.SplitBySubstringForListStr(storyInfo.trigger_condition, '|');

        storyInfo.trigger_condition = "";
        for (int i = 0; i < listTriggerData.Count; i++)
        {
            string itemTriggerData = listTriggerData[i];
            if (CheckUtil.StringIsNull(itemTriggerData))
            {
                continue;
            }
            EditorGUILayout.BeginHorizontal();
            if (EditorUI.GUIButton("删除"))
            {
                listTriggerData.RemoveAt(i);
                i--;
                continue;
            }
            List <string> listItemTriggerData = StringUtil.SplitBySubstringForListStr(itemTriggerData, ':');
            listItemTriggerData[0] = EnumUtil.GetEnumName(EditorUI.GUIEnum <EventTriggerEnum>("触发条件", (int)EnumUtil.GetEnum <EventTriggerEnum>(listItemTriggerData[0]), 300, 20));
            listItemTriggerData[1] = EditorUI.GUIEditorText(listItemTriggerData[1] + "", 100, 20);
            EditorGUILayout.EndHorizontal();
            storyInfo.trigger_condition += (listItemTriggerData[0] + ":" + listItemTriggerData[1]) + "|";
        }
        EditorGUILayout.EndVertical();
    }
예제 #12
0
    public void UITextSelectResult(TextInfoBean textData, List <CharacterBean> listPickCharacterData)
    {
        if (!CheckUtil.StringIsNull(textData.pre_data_minigame))
        {
            //小游戏初始化
            List <PreTypeForMiniGameBean> listPre    = PreTypeForMiniGameEnumTools.GetListPreData(textData.pre_data_minigame);
            List <RewardTypeBean>         listReward = RewardTypeEnumTools.GetListRewardData(textData.reward_data);
            MiniGameBaseBean miniGameData            = PreTypeForMiniGameEnumTools.GetMiniGameData(null, textData.pre_data_minigame, listPickCharacterData);
            miniGameData.listReward = listReward;
            switch (miniGameData.gameType)
            {
            case MiniGameEnum.Combat:
                MiniGameHandler.Instance.handlerForCombat.RegisterNotifyForMiniGameStatus(NotifyForMiniGameStatus);
                MiniGameHandler.Instance.handlerForCombat.InitGame((MiniGameCombatBean)miniGameData);
                break;

            case MiniGameEnum.Debate:
                MiniGameHandler.Instance.handlerForDebate.RegisterNotifyForMiniGameStatus(NotifyForMiniGameStatus);
                MiniGameHandler.Instance.handlerForDebate.InitGame((MiniGameDebateBean)miniGameData);
                break;
            }
            //隐藏重要NPC
            if (NpcHandler.Instance.buildForImportant)
            {
                NpcHandler.Instance.buildForImportant.HideNpc();
            }
            if (NpcHandler.Instance.builderForFamily)
            {
                NpcHandler.Instance.builderForFamily.HideNpc();
            }
        }
        notifyForEvent?.Invoke(NotifyEventTypeEnum.TextSelectResult, new object[] { textData });
    }
예제 #13
0
    /// <summary>
    /// 数据列表
    /// </summary>
    /// <param name="storeInfo"></param>
    public static string GUIListData <E>(string titleName, string content) where E : System.Enum
    {
        //前置相关
        EditorGUILayout.BeginVertical();
        GUILayout.Label(titleName + ":", GUILayout.Width(100), GUILayout.Height(20));
        if (GUILayout.Button("添加", GUILayout.Width(100), GUILayout.Height(20)))
        {
            content += ("|" + EnumUtil.GetEnumName(EnumUtil.GetEnumValueByPosition <E>(0)) + ":" + "1|");
        }
        List <string> listConditionData = StringUtil.SplitBySubstringForListStr(content, '|');

        content = "";
        for (int i = 0; i < listConditionData.Count; i++)
        {
            string itemConditionData = listConditionData[i];
            if (CheckUtil.StringIsNull(itemConditionData))
            {
                continue;
            }
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("删除", GUILayout.Width(100), GUILayout.Height(20)))
            {
                listConditionData.RemoveAt(i);
                i--;
                continue;
            }
            List <string> listItemConditionData = StringUtil.SplitBySubstringForListStr(itemConditionData, ':');
            listItemConditionData[0] = EnumUtil.GetEnumName(EditorGUILayout.EnumPopup(EnumUtil.GetEnum <E>(listItemConditionData[0]), GUILayout.Width(300), GUILayout.Height(20)));
            listItemConditionData[1] = EditorGUILayout.TextArea(listItemConditionData[1] + "", GUILayout.Width(100), GUILayout.Height(20));
            EditorGUILayout.EndHorizontal();
            content += (listItemConditionData[0] + ":" + listItemConditionData[1]) + "|";
        }
        EditorGUILayout.EndVertical();
        return(content);
    }
예제 #14
0
        /// <summary>
        /// Sends a RFC conform email using default .NET classes.
        /// </summary>
        /// <param name="fromAddress">Mail-address of the sender.</param>
        /// <param name="toAddresses">Mail-addresses of the receivers.</param>
        /// <param name="subject">Subject of the mail.</param>
        /// <param name="body">The string for the body of the mail.</param>
        /// <param name="settings">A structure containing the settings for the server.</param>
        /// <returns><c>True</c> if the mail was sent, otherwise <c>false</c>.</returns>
        public static bool SendMail(string fromAddress, string[] toAddresses, string subject, string body, MailServerSettings settings)
        {
            CheckUtil.ThrowIfNullOrWhitespace(() => subject);
            CheckUtil.ThrowIfNullOrWhitespace(() => body);
            var result = false;

            if (!fromAddress.IsValidEmailAddress())
            {
                throw new ArgumentException("Invalid e-mail-address of sender.", nameof(fromAddress));
            }
            if (!toAddresses.Any())
            {
                throw new ArgumentException("No receipient submitted!", nameof(toAddresses));
            }
            if (toAddresses.Any(a => !a.IsValidEmailAddress()))
            {
                throw new ArgumentException("Invalid e-mail-address of on of the recipient.", nameof(toAddresses));
            }
            // Send the mail and use credentials if given.
            using (var message = new MailMessage(fromAddress, toAddresses.First(), subject, body))
            {
                if (toAddresses.Count() > 1)
                {
                    // add the other receipients
                    for (var i = 1; i < toAddresses.Count(); i++)
                    {
                        message.To.Add(toAddresses[i]);
                    }
                }
                result = SendMail(message, settings);
            }
            return(result);
        }
예제 #15
0
 /// <summary>
 /// 设置顾客数据
 /// </summary>
 /// <param name="npcAICustomer"></param>
 public void SetDataForCustomerFood(NpcAICustomerCpt npcAICustomer)
 {
     this.targetNpcAIForCustomerFood = npcAICustomer;
     //设置类型
     if (npcAICustomer.GetOrderForCustomer() == null)
     {
         SetType(TextHandler.Instance.manager.GetTextById(70));
     }
     else
     {
         SetType(TextHandler.Instance.manager.GetTextById(60));
         //设置状态
         objNpcStatus.SetActive(true);
         npcAICustomer.GetCustomerStatus(out string customerStatus);
         SetStatus(customerStatus);
     }
     //设置好友
     if (npcAICustomer as NpcAICostomerForFriendCpt)
     {
         objFriend.SetActive(true);
     }
     //设置团队
     if (npcAICustomer as NpcAICustomerForGuestTeamCpt)
     {
         NpcAICustomerForGuestTeamCpt npcTeam = (NpcAICustomerForGuestTeamCpt)npcAICustomer;
         if (!CheckUtil.StringIsNull(npcTeam.teamCode))
         {
             objTeam.SetActive(true);
             ivTeam.color    = npcTeam.teamColor;
             tvTeamName.text = TextHandler.Instance.manager.GetTextById(49) + ":" + npcTeam.teamData.name;
         }
     }
     ShowCustomerFoodData();
 }
예제 #16
0
        private void CheckLoginInput()
        {
            var  message = "";
            bool isvalid = false;

            if (tbx1.Text != "")
            {
                isvalid = CheckUtil.Username(tbx1.Text);
            }
            else
            {
                btn2.IsEnabled = false;
            }
            if (PasswordBox1.Password == "")
            {
                isvalid = false;
            }
            else if (!CheckUtil.Password(PasswordBox1.Password))
            {
                message += "\n密码太长或太短";
                isvalid  = false;
            }

            btn2.IsEnabled = isvalid;
            tbkMsg.Text    = message;
        }
예제 #17
0
 public override void Submit(DialogView dialogView, DialogBean dialogBean)
 {
     base.Submit(dialogView, dialogBean);
     if (dialogView as PickForMoneyDialogView)
     {
         //如果是金钱选择回调
         PickForMoneyDialogView pickForMoneyDialog = dialogView as PickForMoneyDialogView;
         pickForMoneyDialog.GetPickMoney(out pickMoneyL, out pickMoneyM, out pickMoneyS);
         ShowPickCharacter();
     }
     else if (dialogView as FindCharacterDialogView)
     {
         if (!CheckUtil.StringIsNull(dialogBean.remark) && dialogBean.remark.Equals("Continue"))
         {
             ShowPickCharacter();
         }
         else
         {
             //如果是招募回调
             GameDataBean            gameData            = GameDataHandler.Instance.manager.GetGameData();
             FindCharacterDialogView findCharacterDialog = dialogView as FindCharacterDialogView;
             gameData.listWorkerCharacter.Add(findCharacterDialog.characterData);
             ToastHandler.Instance.ToastHint(string.Format(TextHandler.Instance.manager.GetTextById(1053), findCharacterDialog.characterData.baseInfo.name));
         }
     }
 }
예제 #18
0
    /// <summary>
    /// 设置价格
    /// </summary>
    public void SetPrice()
    {
        priceL = 0;
        priceM = 0;
        priceS = 0;

        if (!CheckUtil.StringIsNull(selectHair))
        {
            priceM += 1;
        }
        if (!CheckUtil.StringIsNull(selectMouth))
        {
            priceM += 10;
        }
        if (!CheckUtil.StringIsNull(selectEye))
        {
            priceL += 10;
        }

        if (!CheckUtil.StringIsNull(selectSkin))
        {
            priceL += 100;
        }
        priceShowView.SetPrice(1, priceL, priceM, priceS);
    }
예제 #19
0
    /// <summary>
    /// 根据类型移除图标
    /// </summary>
    /// <param name="characterStatus"></param>
    public void RemoveStatusIconByMarkId(string markId)
    {
        if (CheckUtil.StringIsNull(markId))
        {
            return;
        }
        for (int i = 0; i < listStatusIcon.Count; i++)
        {
            CharacterStatusIconItemCpt itemData = listStatusIcon[i];
            if (itemData.statusIconData.markId.Equals(markId))
            {
                itemData.transform.DOScale(new Vector3(0, 0, 0), 0.5f).OnComplete(delegate {
                    if (itemData.gameObject)
                    {
                        Destroy(itemData.gameObject);
                    }
                });
                listStatusIcon.Remove(itemData);
                i--;
            }
        }
        float totalX = (listStatusIcon.Count - 1) * 0.5f;
        float startX = -(totalX / 2f);

        //设置新的位置
        for (int i = 0; i < listStatusIcon.Count; i++)
        {
            CharacterStatusIconItemCpt itemCpt = listStatusIcon[i];
            itemCpt.transform.DOLocalMoveX(startX + i * 0.5f, 0.5f);
        }
    }
예제 #20
0
    public void OnClickForSubmit()
    {
        if (CheckUtil.StringIsNull(selectHair) &&
            CheckUtil.StringIsNull(selectEye) &&
            CheckUtil.StringIsNull(selectMouth) &&
            CheckUtil.StringIsNull(selectSkin))
        {
            ToastHandler.Instance.ToastHint(TextHandler.Instance.manager.GetTextById(7005));
            return;
        }
        DialogBean dialogData = new DialogBean();
        string     price      = "";

        if (priceL != 0)
        {
            price += priceL + TextHandler.Instance.manager.GetTextById(16);
        }
        if (priceM != 0)
        {
            price += priceM + TextHandler.Instance.manager.GetTextById(17);
        }
        if (priceS != 0)
        {
            price += priceS + TextHandler.Instance.manager.GetTextById(18);
        }
        dialogData.content = string.Format(TextHandler.Instance.manager.GetTextById(3104), price, characterData.baseInfo.name);
        DialogHandler.Instance.CreateDialog <DialogView>(DialogEnum.Normal, this, dialogData);
    }
예제 #21
0
 /// <summary>
 /// 意图-前往餐桌
 /// </summary>
 /// <param name="buildTableCpt"></param>
 public void IntentForGoToSeat(OrderForCustomer orderForCustomer)
 {
     //停止等待
     if (gameObject == null)
     {
         return;
     }
     StopAllCoroutines();
     this.orderForCustomer = orderForCustomer;
     //判断路径是否有效
     if (CheckUtil.CheckPath(transform.position, orderForCustomer.table.GetSeatPosition()))
     {
         //开启满意度
         characterMoodCpt.SetMood(orderForCustomer.innEvaluation.GetPraise());
         //前往桌子
         movePosition = orderForCustomer.table.GetSeatPosition();
         characterMoveCpt.SetDestination(movePosition);
         //记录该顾客
         InnHandler.Instance.RecordCustomer(orderForCustomer);
     }
     else
     {
         SetMood(30);
         EndOrderAndLeave();
     }
 }
예제 #22
0
 public void RadioButtonSelected(RadioButtonView view, RadioButtonView.RadioButtonStatus buttonStates)
 {
     if (CheckUtil.ListIsNull(listButton))
     {
         return;
     }
     for (int i = 0; i < listButton.Count; i++)
     {
         RadioButtonView itemRB = listButton[i];
         if (itemRB.Equals(view))
         {
             if (!isCancelSelect)
             {
                 itemRB.ChangeStates(RadioButtonView.RadioButtonStatus.Selected);
             }
             if (mRGCallBack != null)
             {
                 mRGCallBack.RadioButtonSelected(this, i, itemRB);
             }
         }
         else
         {
             itemRB.ChangeStates(RadioButtonView.RadioButtonStatus.Unselected);
             if (mRGCallBack != null)
             {
                 mRGCallBack.RadioButtonUnSelected(this, i, itemRB);
             }
         }
     }
 }
예제 #23
0
 /// <summary>
 /// 创建图书列表
 /// </summary>
 /// <param name="listData"></param>
 public void CreateBookList(List <ItemsInfoBean> listData)
 {
     CptUtil.RemoveChildsByActive(objBookItemContainer);
     if (CheckUtil.ListIsNull(listData))
     {
         tvNull.gameObject.SetActive(true);
         return;
     }
     else
     {
         tvNull.gameObject.SetActive(false);
     }
     for (int i = 0; i < listData.Count; i++)
     {
         ItemsInfoBean itemData = listData[i];
         if (!listBook.Contains(itemData.id))
         {
             continue;
         }
         GameObject       objItem        = Instantiate(objBookItemContainer, objBookItemModel);
         ItemBaseTextCpt  itemBaseText   = objItem.GetComponent <ItemBaseTextCpt>();
         PopupItemsButton infoItemsPopup = objItem.GetComponent <PopupItemsButton>();
         Sprite           spIcon         = IconDataHandler.Instance.manager.GetIconSpriteByName(itemData.icon_key);
         itemBaseText.SetData(spIcon, itemData.name, "");
         infoItemsPopup.SetData(itemData, spIcon);
     }
 }
예제 #24
0
        /// <summary>
        /// 加密为数据
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public byte[] EncryptData(string s)
        {
            CheckUtil.ArgumentNotNullOrEmpty(s, "s");

            byte[] inputData = Encoding.UTF8.GetBytes(s);
            byte[] outputData = null;

            using (MemoryStream ms = new System.IO.MemoryStream())
            {
                symmetricAlgorithmProvider.Key = GetLegalKey();
                symmetricAlgorithmProvider.IV = GetLegalIV();

                ICryptoTransform cryptoTransform = symmetricAlgorithmProvider.CreateEncryptor();

                using (CryptoStream cs = new CryptoStream(ms, cryptoTransform, CryptoStreamMode.Write))
                {
                    cs.Write(inputData, 0, inputData.Length);
                    cs.FlushFinalBlock();

                    outputData = ms.ToArray();
                }
            }

            return outputData;
        }
예제 #25
0
    /// <summary>
    /// 修改生命值
    /// </summary>
    /// <param name="life"></param>
    public int AddLife(int life)
    {
        characterLife += life;
        if (characterLife <= 0)
        {
            characterLife = 0;
            SetIntent(RascalIntentEnum.Leave);

            long[] shoutIds = teamData.GetShoutIds();
            TextInfoHandler.Instance.manager.GetTextForTalkByMarkId(shoutIds[1], SetTextInfoData);

            //随机获取一句喊话
            if (!CheckUtil.ListIsNull(listShoutTextInfo))
            {
                TextInfoBean textInfo = RandomUtil.GetRandomDataByList(listShoutTextInfo);
                characterShoutCpt.Shout(textInfo.content);
            }
            //快速离开
            characterMoveCpt.SetMoveSpeed(5);
        }
        else if (characterLife > characterMaxLife)
        {
            characterLife = characterMaxLife;
        }
        characterLifeCpt.SetData(characterLife, characterMaxLife);
        return(characterLife);
    }
예제 #26
0
        /// <summary>
        /// 解密为字符串
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public string DecryptString(string s)
        {
            CheckUtil.ArgumentNotNullOrEmpty(s, "s");

            byte[] inputData = Convert.FromBase64String(s);
            string result = string.Empty;

            using (MemoryStream ms = new System.IO.MemoryStream(inputData))
            {
                symmetricAlgorithmProvider.Key = GetLegalKey();
                symmetricAlgorithmProvider.IV = GetLegalIV();

                ICryptoTransform encrypto = symmetricAlgorithmProvider.CreateDecryptor();

                CryptoStream cs = new CryptoStream(ms, encrypto, CryptoStreamMode.Read);
                StreamReader sr = new StreamReader(cs);
                result = sr.ReadLine();

                //CryptoStream cs = new CryptoStream(ms, encrypto, CryptoStreamMode.Read);
                //byte[] outputData = new byte[inputData.Length];
                //cs.Read(outputData, 0, outputData.Length);

                //result = Encoding.UTF8.GetString(outputData).TrimEnd(new char[] { '\0' });

                cs.Clear();
                cs.Close();
            }

            return result;
        }
예제 #27
0
        void DoLoadDataSet(IDbCommand command, DataSet dataSet, string[] tableNames)
        {
            CheckUtil.ArgumentNotNullOrEmptyForCollection(tableNames, "tableNames");

            for (int i = 0; i < tableNames.Length; i++)
            {
                CheckUtil.ArgumentNotNullOrEmpty(tableNames[i], string.Concat("tableNames[", i, "]"));
                //if (string.IsNullOrEmpty(tableNames[i])) throw new ArgumentException("值不能为空或者空字符串", string.Concat("tableNames[", i, "]"));
            }

            try
            {
                using (DbDataAdapter adapter = GetDataAdapter(UpdateBehavior.Standard))
                {
                    ((IDbDataAdapter)adapter).SelectCommand = command;

                    //DateTime startTime = DateTime.Now;
                    string systemCreatedTableNameRoot = "Table";
                    for (int i = 0; i < tableNames.Length; i++)
                    {
                        string systemCreatedTableName = (i == 0) ? systemCreatedTableNameRoot : systemCreatedTableNameRoot + i;

                        adapter.TableMappings.Add(systemCreatedTableName, tableNames[i]);
                    }

                    adapter.Fill(dataSet);
                    //instrumentationProvider.FireCommandExecutedEvent(startTime);
                }
            }
            catch (Exception e)
            {
                //instrumentationProvider.FireCommandFailedEvent(command.CommandText, ConnectionStringNoCredentials, e);
                throw;
            }
        }
예제 #28
0
    /// <summary>
    /// 提交按钮
    /// </summary>
    public void OnClickSubmit()
    {
        UIGameText   uiGameText = (UIGameText)uiComponent;
        GameDataBean gameData   = GameDataHandler.Instance.manager.GetGameData();

        AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForNormal);
        //检测是否启用小游戏
        if (CheckUtil.StringIsNull(textData.pre_data_minigame))
        {
            List <PreTypeBean> listPre = PreTypeEnumTools.GetListPreData(textData.pre_data);
            foreach (PreTypeBean itemPreData in listPre)
            {
                PreTypeEnumTools.GetPreDetails(itemPreData, gameData);
                if (!itemPreData.isPre)
                {
                    ToastHandler.Instance.ToastHint(itemPreData.spPreIcon, itemPreData.preFailStr);
                    return;
                }
            }
            //完成前置条件
            PreTypeEnumTools.CompletePre(listPre, gameData);
            //完成所有奖励
            RewardTypeEnumTools.CompleteReward(null, textData.reward_data);
            uiGameText.SelectText(textData);
        }
        else
        {
            DialogBean dialogBean = new DialogBean();
            PickForCharacterDialogView dialogView = DialogHandler.Instance.CreateDialog <PickForCharacterDialogView>(DialogEnum.PickForCharacter, this, dialogBean);
            PreTypeForMiniGameEnumTools.GetPlayerNumber(textData.pre_data_minigame, out int playerNumber);
            dialogView.SetPickCharacterMax(playerNumber);
        }
    }
예제 #29
0
    protected long GetNpcEquip(SexEnum sex, string data)
    {
        long hatId = 0;

        if (CheckUtil.StringIsNull(data))
        {
            hatId = -1;
        }
        else
        {
            string[] hatList = StringUtil.SplitBySubstringForArrayStr(data, ',');
            if (hatList.Length >= 2)
            {
                switch (sex)
                {
                case SexEnum.Man:
                    hatId = long.Parse(hatList[0]);
                    break;

                case SexEnum.Woman:
                    hatId = long.Parse(hatList[1]);
                    break;

                default:
                    hatId = long.Parse(hatList[0]);
                    break;
                }
            }
            else
            {
                hatId = long.Parse(npc_hat);
            }
        }
        return(hatId);
    }
예제 #30
0
    public void CreateCharacterList(List <MiniGameCharacterBean> listCharacterData, List <Vector3> listCharacterPosition, NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum npcType)
    {
        if (CheckUtil.ListIsNull(listCharacterData))
        {
            return;
        }
        for (int i = 0; i < listCharacterData.Count; i++)
        {
            MiniGameCharacterBean itemCharacterData = listCharacterData[i];

            NpcAIMiniGameCookingCpt npcCpt = CreateCharacter(itemCharacterData, listCharacterPosition[i], npcType);
            switch (npcType)
            {
            case NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum.Player:
                listEnemyCharacter.Add(npcCpt);
                npcCpt.characterMoveCpt.SetMoveSpeed(5);
                break;

            case NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum.Auditer:
                listAuditerCharacter.Add(npcCpt);
                break;

            case NpcAIMiniGameCookingCpt.MiniGameCookingNpcTypeEnum.Compere:
                listCompereCharacter.Add(npcCpt);
                break;
            }
        }
    }