private bool CheckVisitorRegularizeResult()
        {
            var res = _visitorRegularizeResult.Read();

            if (res == null)
            {
                return(false);
            }

            var dialogManager = GetDialogManager();

            dialogManager.ShowWaitingDialog(false);

            if (res.result == ResultCode.OK)
            {
                // 转正成功。
                GetAppController().ClearAppStateData();
                dialogManager.ShowConfirmBox(
                    "恭喜您转正成功!",
                    true, "马上登陆", () =>
                {
                    LoginRecord.LastUsername        = _regularizeUsername;
                    LoginRecord.LastPassword        = _regularizePassword;
                    LoginRecord.LastLoginType       = LoginRecord.NormalUser;
                    LoginRecord.LastVisitorUsername = _regularizeUsername;
                    LoginRecord.SaveAll();

                    MyLog.InfoWithFrame("VisitorRegularize",
                                        string.Format("save visitorUsername:{0}", _regularizeUsername));
#if UNITY_IOS
                    GetIosSDK().SaveUsername(_regularizeUsername);
#endif
#if UNITY_ANDROID // TODO 将visitorUsername保存到安卓客户端中。
#endif

                    GetNetworkManager().InitLogin();
                },
                    false, null, null,
                    true, false, false);

                GetRemoteAPI().RequestUserInfo();

                Hide();
            }
            else
            {
                switch (res.result)
                {
                case ResultCode.P_REGULARIZE_NO_VISITOR:
                    dialogManager.ShowMessageBox("转正失败,当前游客数据不存在!");
                    break;

                case ResultCode.P_REGISTER_USERNAME_ILLEGAL:
                    dialogManager.ShowMessageBox("账号格式不正确!只能包含字母、数字和下划线");
                    break;

                case ResultCode.P_REGISTER_PASSWORD_ILLEGAL:
                    dialogManager.ShowMessageBox("密码格式不正确!只能包含字母、数字和下划线");
                    break;

                case ResultCode.P_REGISTER_NICKNAME_ILLEGAL:
                    dialogManager.ShowMessageBox("昵称不合法!\n不能包含回车字符,长度不能超过16个字");
                    break;

                case ResultCode.P_REGISTER_USER_EXIST:
                    dialogManager.ShowMessageBox("账号已存在,请换一个重试");
                    break;

                default:
                    dialogManager.ShowToast("转正失败!", 2, true);
                    break;
                }
            }

            return(true);
        }
 public static void LoadPlayPostfix2(AudioSourceMgr __instance, string f_strFileName)
 {
     MyLog.LogMessage("LoadPlayPostfix2:" + f_strFileName);
 }
예제 #3
0
 void Start()
 {
     isTextInited = MyLog.Init();
     ShowMsg.ChangeColor(ShowMsg.MyIcons.gps);
 }
예제 #4
0
 void Start()
 {
     MyLog.I("MySoundManager Start");
     audioSource = gameObject.GetComponent <AudioSource>();
 }
        public void BeforeSendReply(ref Message reply, object correlationState)
        {
            Guid activityId = (Guid)correlationState;

            MyLog.Message("BeforeSendReply", activityId);
        }
예제 #6
0
 public void toFacebookEvent()
 {
     MyLog.I(TAG, "toFacebookEvent");
     // FB.LogAppEvent(AppEventName.CompletedRegistration, 200, null);
 }
예제 #7
0
 // Update is called once per frame
 void Update()
 {
     MyLog.I(TAG, "MyAdManager Update");
 }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from the Admin User (protected)
        try
        {
            string id       = Request["id"];
            IMyLog logItemX = MyLog.GetLogger("ItemX");

            switch (id)
            {
            case "GetAllTelNumbers":     // as used by the fone
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                Response.ContentType = "text/plain";
                Response.Write("GetAllTelNumbers:\r\n");
                Response.Write(DateTime.UtcNow.ToString() + "\r\n");
                {
                    int telCounter  = 0;
                    int userCounter = 0;
                    List <MobileNoHandlerWithUserName> commercialUsersToConfirm = new List <MobileNoHandlerWithUserName>();

                    DSSwitch.appUser().RetrieveAll(
                        Data_AppUserFile.SortType.Date,
                        delegate(Data_AppUserFile d)
                    {
                        if ((d.AccountStatus == Data_AppUserFile.eUserStatus.verified_welcome_No_sent) ||
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.verified_welcome_queued) ||
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.verified_checkingTelNumbers))
                        {
                            userCounter++;
                            Response.Write("User: "******"\r\n");
                            foreach (string m1 in d.MobileNumbers_AllConfirmed__.MobileNumberArray)
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                            foreach (string m1 in d.MobileNumbers_AllUnConfirmed__.MobileNumberArray)
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                        }
                        else if (
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthly) ||
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.commercial_payassent))
                        {
                            if (d.AddNumber_ActivateOnSyncRequest)
                            {
                                userCounter++;
                                Response.Write("User: "******"\r\n");
                                MobileNoHandlerWithUserName conf = new MobileNoHandlerWithUserName(d.Email);
                                foreach (string tel1 in d.MobileNumbers_AllUnConfirmed__.MobileNumberArray)
                                {
                                    telCounter++;
                                    Response.Write(tel1 + "\r\n");
                                    conf.Handler.Add(tel1);
                                }
                                commercialUsersToConfirm.Add(conf);
                            }
                        }
                    },
                        logItemX);
                    Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString() + "\r\n");
                }
                break;

            case "GetTelNumbersBlockedUsers":
                Response.ContentType = "text/plain";
                Response.Write("GetTelNumbersBlockedUsers:\r\n");
                Response.Write(DateTime.UtcNow.ToString() + "\r\n");
                {
                    int telCounter  = 0;
                    int userCounter = 0;

                    DSSwitch.appUser().RetrieveAll(
                        Data_AppUserFile.SortType.Date,
                        delegate(Data_AppUserFile d)
                    {
                        if (d.AccountStatus == Data_AppUserFile.eUserStatus.blocked)
                        {
                            userCounter++;
                            Response.Write("User: "******"\r\n");
                            foreach (string m1 in d.MobileNumberArray())
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                        }
                    },
                        logItemX);
                    Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString());
                }
                break;

            case "GetTelNumbers":
                // no check as this comes from the TrayApp - NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                Response.Write("GetTelNumbers:\r\n");
                Response.Write(DateTime.UtcNow.ToString() + "\r\n");
                {
                    int telCounter  = 0;
                    int userCounter = 0;

                    DSSwitch.appUser().RetrieveAll(
                        Data_AppUserFile.SortType.Date,
                        delegate(Data_AppUserFile d)
                    {
                        if (d.IsAccountActive("Welcome"))
                        {
                            userCounter++;
                            Response.Write("User: "******"\r\n");
                            foreach (string m1 in d.MobileNumberArray())
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                        }
                    },
                        logItemX);
                    Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString());
                }
                break;

            case "Home":
                Response.Redirect("~/");
                break;

            case "LibVer":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                Assembly a = Assembly.GetAssembly(typeof(IMyLog));
                Response.ContentType = "text/plain";
                a.WriteAssemblyVersion(Response.Output);
                break;

            case "DSSwitch":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                Response.Write("appUser:   "******"\r\n");
                Response.Write("appWallet: " + DSSwitch.appWallet().GetInfo() + "\r\n");
                Response.Write("msgFile00: " + DSSwitch.msgFile00().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n");
                Response.Write("msgFile02: " + DSSwitch.msgFile02().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n");
                Response.Write("msgFile04: " + DSSwitch.msgFile04().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n");
                Response.Write(DSSwitch.GetMaintenanceLog() + "\r\n");
                break;

            case "SetSubSystem":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                string val = Request["val"];
                var    sub = DSSwitch.full().GetSystems(false).FirstOrDefault(_ => _.Name == val);
                if (sub == null)
                {
                    Response.ContentType = "text/plain";
                    Response.Write("No such SubSystem " + val + "\r\n");
                }
                else
                {
                    SessionData.SessionsSystem_Set(Session, sub);
                    Response.Redirect("~/Admin.aspx");
                }
                break;

            case "ShowSubSystem":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                DSSwitch.full().GetSystems(false).ForEach(_ => Response.Write(string.Format("{0}, {1}, {2}\r\n", _.Name, _.APIId, _.Default)));
                Response.Write("\r\n");
                var cur = SessionData.SessionsSystem_Get(Session);
                Response.Write(string.Format("currently on\r\n{0}, {1}, {2}\r\n", cur.Name, cur.APIId, cur.Default));
                break;

            case "Screen":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "image/png";
                byte[] baImg;
                using (DataFile_ScreenShot ss = new DataFile_ScreenShot(NiceASP.SessionData.SessionsSystem_Get(Session), DataFile_Base.OpenType.ReadOnly_CreateIfNotThere))
                {
                    MemoryStream ms = new MemoryStream();
                    ss.imgScreen.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    baImg = ms.ToArray();
                }
                Response.OutputStream.Write(baImg, 0, baImg.Length);
                Response.OutputStream.Flush();
                break;

            case "AllValues":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                int count = 0;
                foreach (string k1 in Request.ServerVariables)
                {
                    Response.Write(count++.ToString() + ":" + k1 + " = " + Request.ServerVariables[k1] + "\r\n");
                }
                using (StreamReader sr = new StreamReader(Request.InputStream))
                {
                    Response.Write(sr.ReadToEnd());
                    Response.Write("\r\n");
                }
                Response.Write("Done a");
                break;

            case "TestX":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                Response.ContentType = "text/plain";
                string pathX = Request.ServerVariables["APPL_PHYSICAL_PATH"];

                Response.Write("in1b: " + pathX + "\n");
                pathX = Directory.GetParent(pathX).FullName;
                foreach (string p1 in Directory.GetFiles(pathX))
                {
                    Response.Write(p1 + "\n");
                }

                Response.Write("in2: " + pathX + "\n");
                pathX = Directory.GetParent(pathX).FullName;
                foreach (string p1 in Directory.GetFiles(pathX))
                {
                    Response.Write(p1 + "\n");
                }

                Response.Write("in3: " + pathX + "\n");
                foreach (string p1 in Directory.GetFiles(pathX))
                {
                    Response.Write(p1 + "\n");
                }

                throw new NotImplementedException("end");

            case "Dir":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                FolderNames.CreateFoldersForAsp(NiceASP.SessionData.SessionsSystem_Get(Session));
                Response.ContentType = "text/plain";
                Response.Write("Done Dir");
                break;

            default:
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                throw new ArgumentException();
                //break;
            }
        }
        catch (Exception se)
        {
            Response.ContentType = "text/plain";
            Response.Write("ups");
            Response.Write(se.ToString());
            Response.Write(se.Message);
        }
    }
예제 #9
0
        public static void SetMaidStatus(Maid maid)
        {
            if (maid == null)
            {
                MyLog.LogFatal("MaidStatusUtill.SetMaidStatus:null");
                return;
            }
            MyLog.LogMessage("SetMaidStatus : " + MyUtill.GetMaidFullName(maid));

            maid.status.employmentDay = 1;// 고용기간

            maid.status.baseAppealPoint = 9999;
            maid.status.baseCare        = 9999;
            maid.status.baseCharm       = 9999;
            maid.status.baseCooking     = 9999;
            maid.status.baseDance       = 9999;
            maid.status.baseElegance    = 9999;
            maid.status.baseHentai      = 9999;
            maid.status.baseHousi       = 9999;
            maid.status.baseInyoku      = 9999;
            maid.status.baseLovely      = 9999;
            maid.status.baseMaxHp       = 9999;
            maid.status.baseMaxMind     = 9999;
            maid.status.baseMaxReason   = 9999;
            maid.status.baseMvalue      = 9999;
            maid.status.baseReception   = 9999;
            maid.status.baseTeachRate   = 9999;
            maid.status.baseVocal       = 9999;

            maid.status.studyRate  = 0;   // 습득율
            maid.status.likability = 999; // 호감도

            if (maid.boNPC)
            {
            }

            //if (true)
            //{
            //    //maid.status.contract = Contract.;// 적용 방식 고민 필요
            //}

            //maid.status.specialRelation = SpecialRelation.Married;// 되는건가?
            maid.status.additionalRelation = AdditionalRelation.Slave;// 되는건가?

            //maid.status.heroineType = HeroineType.Original;// 기본, 엑스트라 , 이전 // 사용 금지.일반 메이드를 엑스트라로 하면 꼬인다. 반대도 마찬가지
            maid.status.relation  = Relation.Lover;    // 호감도
            maid.status.seikeiken = Seikeiken.Yes_Yes; //


            // 특징
            MyLog.LogMessage("SetMaidStatus.AddFeature: " + MyUtill.GetMaidFullName(maid));
            foreach (Feature.Data data in Feature.GetAllDatas(true))
            {
                maid.status.AddFeature(data);
            }


            // 성벽
            MyLog.LogMessage("SetMaidStatus.AddPropensity: " + MyUtill.GetMaidFullName(maid));
            foreach (Propensity.Data data in Propensity.GetAllDatas(true))
            {
                maid.status.AddPropensity(data);
            }


            MyLog.LogMessage("SetMaidStatus.WorkData max : " + MyUtill.GetMaidFullName(maid), maid.status.workDatas.Count);
            foreach (WorkData workData in maid.status.workDatas.GetValueArray())
            {
                workData.level     = 10;
                workData.playCount = 9999U;
            }
        }
예제 #10
0
        private void processRequest()
        {
            while (IsRunning)
            {
                try
                {
                    //===================REQUEST CANCELING==================================
                    if (cancleRequest.Count > 0)
                    {
                        MyLog.Log(this, "Cancel request" + "...");
                        var cancleReqPacket = cancleRequest.Dequeue();

                        var cUids = cancleReqPacket.DataInStringList;
                        if (cUids != null)
                        {
                            Queue <RequestPacket> tempRequest = new Queue <RequestPacket>();
                            for (int i = 0; i < pendingRequest.Count; i++)
                            {
                                var tPacket = pendingRequest.Dequeue();
                                var tUid    = tPacket.Uid;

                                if (cUids.Contains(tUid))
                                {
                                    cUids.Remove(tUid);
                                }
                                else
                                {
                                    tempRequest.Enqueue(tPacket);
                                }
                            }
                            pendingRequest = tempRequest;
                        }
                        MyLog.Log(this, "Cancel request" + "...Done");
                    }
                    //===================REQUEST PROCESSING==================================
                    if (pendingRequest.Count > 0)
                    {
                        var packet          = pendingRequest.Dequeue();
                        var responseHandler = packet.OnlineModuleResponse;
                        var requestedUrl    = packet.Url;

                        MyLog.Log(this, $"Processing request url {requestedUrl}" + "...");
                        try
                        {
                            if (isStringFileLink(requestedUrl))
                            {
                                Log.Debug("Online Module:", $"Downloading (string) url {requestedUrl}");

                                MyLog.Log(this, $"Downloading string file url {requestedUrl}" + "...");
                                string result = Helper.DownloadFile(requestedUrl);
                                packet.DataInString = result;
                                MyLog.Log(this, $"Downloading string file url {requestedUrl}" + "...Done");
                            }
                            else
                            {
                                //not a string file use external links to view the item
                                MyLog.Log(this, $"Downloading non-string file url {requestedUrl}" + "...");
                                if (!System.IO.Directory.Exists(TempDirectory))
                                {
                                    System.IO.Directory.CreateDirectory(TempDirectory);
                                }
                                string extrnalLink = ($"{TempDirectory}/{Guid.NewGuid().ToString()}.pdf");
                                MyLog.Log(this, $"Download file src=> {requestedUrl} \t des=>{extrnalLink}" + "...");

                                Helper.DownloadFile(requestedUrl, extrnalLink);
                                MyLog.Log(this, $"Download file src=> {requestedUrl} \t des=>{extrnalLink}" + "...Done");

                                packet.DataInString = null;
                                packet.ExtrnalLink  = extrnalLink;
                                MyLog.Log(this, $"Downloading non-string file url {requestedUrl}" + "...Done");
                            }
                            Log.Debug("Online Module:", $"Making processed callback for url {requestedUrl}");
                            responseHandler.RequestProcessedCallback(packet);
                        }
                        catch (Exception ex)
                        {
                            MyLog.Log(this, "--Error " + ex.Message);
                            packet.Error = ex.Message;
                            responseHandler.RequestProcessingError(packet);
                        }
                        MyLog.Log(this, $"Processing request url {requestedUrl}" + "...Done");
                    }
                }
                catch (Exception) { }
                Thread.Sleep(1);
            }
        }
예제 #11
0
        private void AsyncLoadDialog <T>(
            string dialogName,
            bool autoShow,
            bool cache,
            Action action,
            Func <TaskResult> checker,
            Action <T> success,
            Action <int, string> failHandler,
            Action timeoutHandler = null,
            int timeout           = 10,
            bool showWaiting      = true) where T : UIWindow
        {
            if (string.IsNullOrEmpty(dialogName))
            {
                return;
            }

            if (showWaiting)
            {
                ShowWaitingDialog(true, timeout);
            }

            if (action != null)
            {
                action();
            }

            _task.ExecuteTask(
                checker,
                () =>
            {
                if (showWaiting)
                {
                    ShowWaitingDialog(false);
                }
            },
                // success
                () =>
            {
                var dialog = default(T);
                if (cache && _dialogCache.ContainsKey(dialogName))
                {
                    dialog = _dialogCache[dialogName] as T;
                }

                if (!dialog)
                {
                    dialog = CreateDialog(dialogName) as T;
                }

                if (dialog)
                {
                    dialog.transform.SetParent(_gameCanvas.GetDialogContainer(), false);
                    dialog.transform.SetAsLastSibling();
                    if (autoShow)
                    {
                        dialog.Show();
                    }

                    if (cache)
                    {
                        if (_dialogCache.ContainsKey(dialogName))
                        {
                            _dialogCache[dialogName] = dialog;
                        }
                        else
                        {
                            _dialogCache.Add(dialogName, dialog);
                        }
                    }

                    if (success != null)
                    {
                        success(dialog);
                    }
                }
                else
                {
                    MyLog.ErrorWithFrame(name, "创建对话框失败 :" + dialogName + " 检查是否是类型不匹配");
                }
            },
                (errCode, errMsg) =>
            {
                if (failHandler != null)
                {
                    failHandler(errCode, errMsg);
                }
            },
                () =>
            {
                if (showWaiting)
                {
                    ShowWaitingDialog(false);
                }

                if (timeoutHandler != null)
                {
                    timeoutHandler();
                }
            },
                timeout
                );
        }
 public static void StopSe(SoundMgr __instance, string f_strFileName)
 {
     MyLog.LogMessage("StopSe"
                      , f_strFileName
                      );
 }
 public static void StopEnv(SoundMgr __instance, float f_fTime)
 {
     MyLog.LogMessage("StopEnv"
                      , f_fTime
                      );
 }
 public static void SetVolumeDance(SoundMgr __instance, int f_nVol)
 {
     MyLog.LogMessage("SetVolumeDance"
                      , f_nVol
                      );
 }
예제 #15
0
 public void HandleOnPurchaseRequest(TJPlacement placement, TJActionRequest request, string productId)
 {
     MyLog.D(TAG, "C#: HandleOnPurchaseRequest");
     request.Completed();
 }
예제 #16
0
 private void OnPlaying()
 {
     MyLog.Red("一直运行?");
 }
예제 #17
0
 public void HandleOnRewardRequest(TJPlacement placement, TJActionRequest request, string itemId, int quantity)
 {
     MyLog.D(TAG, "C#: HandleOnRewardRequest");
     request.Completed();
 }
예제 #18
0
        /// <summary>
        /// 发送并接收应答(同步)
        /// </summary>
        /// <param name="protocol">发送协议内容</param>
        /// <param name="tryTimes"></param>
        /// <returns></returns>
        public PLCResponse Send(string cmdText, int tryTimes = 2)
        {
            lock (lockObj)
            {
                int         tmpTimes = 1;
                PLCResponse resp     = new PLCResponse();
                if (socket == null || !socket.Connected)
                {
                    if (!Connect())
                    {
                        resp.ErrorMsg = "[" + this.IP + "] 连接PLC失败!";
                        return(resp);
                    }
                }
                do
                {
                    tmpTimes++;
                    try
                    {
                        string logMsg = DateTime.Now.ToString("HH:mm:ss.fff") + " [" + this.IP + "] 发送:" + cmdText;
                        if (ShowLog)
                        {
                            ShowMsg(logMsg);
                        }
                        if (!cmdText.StartsWith("RD"))
                        {
                            MyLog.WriteLog(logMsg, "PLC");
                        }
                        byte[] sendBuffer = Encode(cmdText);
                        int    sendLen    = socket.Send(sendBuffer);
                        if (sendLen == sendBuffer.Length)//TODO:测试发送长度是否一致
                        {
                            resp.HasError = false;
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        string errMsg = $"[{this.IP}] 发送失败,当前第{tmpTimes}次!";
                        MyLog.WriteLog(errMsg, ex, "PLC");
                        ShowMsg(errMsg);
                        Connect();
                    }
                    Thread.Sleep(100);
                } while (tmpTimes <= tryTimes);

                if (resp.HasError)//发送失败
                {
                    resp.ErrorMsg = $"[{this.IP}] 发送失败!尝试发送次数{tryTimes}次。";
                    return(resp);
                }
                try
                {
                    byte[] buffer    = new byte[1024 * 1024];
                    int    rcvLength = socket.Receive(buffer);
                    resp.HasError = false;
                    resp.Text     = Decode(buffer.Take(rcvLength).ToArray());
                    resp.Text     = resp.Text.Replace("\n", "");
                    resp.Text     = resp.Text.Split('\r')[0];//处理万一有粘包
                    string rcvMsg = DateTime.Now.ToString("HH:mm:ss.fff") + " [" + this.IP + "] 接收:" + resp.Text;
                    if (ShowLog)
                    {
                        ShowMsg(rcvMsg);
                    }
                    if (PLCHelper.ErrorMsg.Keys.Contains(resp.Text))
                    {
                        resp.HasError = true;
                        resp.ErrorMsg = PLCHelper.ErrorMsg[resp.Text];
                        MyLog.WriteLog("[" + this.IP + "] PLC响应异常!" + resp.ErrorMsg, "PLC");
                    }
                    //MyLog.WriteLog(rcvMsg,"PLC");
                }
                catch (Exception ex)
                {
                    resp.HasError = true;
                    resp.ErrorMsg = "[" + this.IP + "] PLC响应异常!";
                    MyLog.WriteLog("[" + this.IP + "] PLC响应异常!", ex, "PLC");
                }
                return(resp);
            }
        }
예제 #19
0
 // Use this for initialization
 void Start()
 {
     MyLog.I(TAG, "MyAdManager Start");
 }
예제 #20
0
 public PLCResponse SetOnePoint(string ioPoint, int val)
 {
     MyLog.WriteLog($"{this.IP}设置{ioPoint}:{val}", "PLC");
     return(Send($"WR {ioPoint} {val}\r"));
 }
예제 #21
0
        public void AddSushiInOrder(Sushi sushi)
        {
            float amountOfSushi = 0.0f;

            if (sushi.HalfOrFull)
            {
                do
                {
                    Console.WriteLine($"How much of {sushi.Name} whoud you like add to order? You can get a half of them." +
                                      $"\nEnter the quantity of them (like #,#) & press 'ENTER'.\nPress 'ESCAPE' if you whoudn't get this kind of sushi.");

                    if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                    {
                        break;
                    }

                    try
                    {
                        amountOfSushi = Convert.ToSingle(Console.ReadLine());

                        if (amountOfSushi == 0)
                        {
                            Console.WriteLine("You added no sushi of this kind!");
                            return;
                        }
                        else if (amountOfSushi % 0.5f == 0)
                        {
                            break;
                        }
                        Console.WriteLine("Your can add only multiple of half this kind of sushi! Try agein.");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Invalid data entered\nTry agein");

                        MyLog.Logs($"Entered invalid quantity of sushi!\n{ex.Message}\n{ex.StackTrace}");

                        continue;
                    }
                }while (true);
            }
            else
            {
                do
                {
                    Console.WriteLine($"How much of {sushi.Name} whoud you like add to order? You can't get a half of them." +
                                      $"\nEnter the quantity of them & press 'ENTER'.\nPress 'ESCAPE' if you whoudn't get this kind of sushi.");

                    if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                    {
                        break;
                    }

                    try
                    {
                        amountOfSushi = Convert.ToSingle(Console.ReadLine());

                        if (amountOfSushi == 0)
                        {
                            Console.WriteLine("You added no sushi of this kind!");
                            return;
                        }

                        if (amountOfSushi % 1 == 0)
                        {
                            break;
                        }
                        Console.WriteLine("Your can add only whole this kind of sushi! Try agein.");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Invalid data entered\nTry agein");

                        MyLog.Logs($"Entered invalid quantity of sushi!\n{ex.Message}\n{ex.StackTrace}");

                        continue;
                    }
                }while (true);
            }

            sushi.Things = Convert.ToInt32(sushi.Things * amountOfSushi);
            sushi.Cost   = sushi.Cost * amountOfSushi;
            sushi.Weight = sushi.Weight * amountOfSushi;

            sushiOrder.Add(sushi);

            try
            {
                var tempSushi = sushiOrder.SingleOrDefault(item => item.Id == sushi.Id);
            }
            catch (Exception ex)
            {
                DeleteSushiFromOrder(sushi.Id);

                MyLog.Logs($"DeleteSushiFromOrder done!\n{ex.Message}\n{ex.StackTrace}");
            }
        }
예제 #22
0
 public PLCResponse ReadOnePoint(string ioPoint)
 {
     MyLog.WriteLog($"{this.IP}读取{ioPoint}", "PLC");
     return(Send($"RD {ioPoint}.U\r"));
 }
예제 #23
0
 public void playSound1()
 {
     MyLog.I("playSound1");
     audioSource.clip = sound01;
     audioSource.PlayOneShot(sound01);
 }
예제 #24
0
 public void HandlePlacementRequestFailure(TJPlacement placement, string error)
 {
     MyLog.D(TAG, "C#: HandlePlacementRequestFailure");
     MyLog.D(TAG, "C#: Request for " + placement.GetName() + " has failed because: " + error);
 }
예제 #25
0
        internal static Dictionary <string, string> ReadElementAttributes(By by, IWebDriver webDriver)
        {
            /*
             *
             *  [
             *    {
             *      "Key": "href",
             *      "Value": "http://example.com"
             *    },
             *    {
             *      "Key": "class",
             *      "Value": " "
             *    }
             *  ]
             */

            var result = new Dictionary <string, string>();

            var elements = webDriver.FindElements(by);

            if (elements.Count == 0)
            {
                throw new NotFoundException("ReadElementAttributes: Element was not found" + by.ToString());
            }

            var currentElement = elements[0];

            IJavaScriptExecutor jsExec = webDriver as IJavaScriptExecutor;
            string json = (string)jsExec.ExecuteScript(
                @"
                var jsonResult = ""[\n"";
                
                var attrs = arguments[0].attributes;
                for (var l = 0; l < attrs.length; ++l) {
                    var a = attrs[l]; 
                    
                    var name  = a.name.replace(/\\/g, ""\\\\"").replace(/\""/g, ""\\\"""");
                    var value = a.value.replace(/\\/g, ""\\\\"").replace(/\""/g, ""\\\"""");

                    jsonResult += '{ ""Key"": ""' + name + '"", ""Value"": ""' + value + '""},';

                }
                jsonResult += ""]\n"";
                
                return jsonResult;

            ", currentElement);

            MyLog.Write("JSON:\n" + json);

            var attributesList = DeserializeAttributesFromJson(json);

            foreach (var attr in attributesList)
            {
                result.Add(attr.Key, attr.Value);
            }

            result.Add("TagName", currentElement.TagName);

            return(result);
        }
예제 #26
0
 public void HandlePlacementContentShow(TJPlacement placement)
 {
     MyLog.D(TAG, "C#: HandlePlacementContentShow");
 }
예제 #27
0
 void Start()
 {
     MyLog.Log($"XXXManager.Instance1 == XXXManager.Instance2 : {ReferenceEquals(XXXManager.Instance, XXXManager.Instance)}");;
     XXXManager.Instance.Show("Hello!");
 }
예제 #28
0
 public void HandlePlacementContentDismiss(TJPlacement placement)
 {
     MyLog.D(TAG, "C#: HandlePlacementContentDismiss");
 }
예제 #29
0
    /// <summary>
    /// 发送数据
    /// </summary>
    private void SendData(byte[] v)
    {
        try
        {
            //if (isSending) return;
            //UnityThread.executeInUpdate(() => { isSending = true; });
            Debug.Log("准备发送");
            if (writer_vstream != null)
            {
                writer_vstream.WriteInt32(v.Length);
                writer_vstream.WriteBytes(v);

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        writer_vstream.WriteSingle(martrix_camera_to_world[i, j]);
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        writer_vstream.WriteSingle(martrix_projection[i, j]);
                    }
                }

                DataWriterStoreOperation operation = writer_vstream.StoreAsync();
                operation.Completed = new AsyncOperationCompletedHandler <uint>(DataSentHandler);
            }
            else
            {
                Debug.Log("未与TX2建立连接,跳过本次发送");
            }

            if (writer_pc != null)
            {
                writer_pc.WriteInt32(v.Length);
                writer_pc.WriteBytes(v);

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        if (isSendWarning)
                        {
                            if (i == 0 && j == 0)
                            {
                                writer_pc.WriteSingle(100);
                            }
                            if (i == 0 && j == 1)
                            {
                                writer_pc.WriteSingle(1);
                                isSendWarning = false;
                            }
                        }
                        else
                        {
                            writer_pc.WriteSingle(martrix_camera_to_world[i, j]);
                        }
                    }
                }
                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        writer_pc.WriteSingle(martrix_projection[i, j]);
                    }
                }

                DataWriterStoreOperation operation2 = writer_pc.StoreAsync();
                operation2.Completed = new AsyncOperationCompletedHandler <uint>(DataSentHandler_PC);
            }
            else
            {
                Debug.Log("未与PC建立连接,跳过本次发送");
            }
        }
        catch (Exception e)
        {
            MyLog.DebugLog(e.Message);
        }
    }
예제 #30
0
        public static void SetFacilityAllMaid(ScheduleMgr.ScheduleTime scheduleTime)
        {
            if (ScheduleMgrPatch.m_scheduleApi == null)
            {
                MyLog.LogMessage("SetSlotAllDel"
                                 , "스케줄 관리 접속 한번 필요"
                                 );
                return;
            }

            if (configEntryUtill["SetFacilityAllMaid", false])
            {
                MyLog.LogMessage(
                    "SetFacilityAllMaid1"
                    );
            }
            //List<KeyValuePair<int, ScheduleCSVData.Work>> works = ScheduleCSVData.WorkData.ToList();

            // 스케줄의 슬롯 정보
            // public Maid GetScheduleSlot(int slotNo)
            // if (string.IsNullOrEmpty(this.scheduleSlot[slotNo].maid_guid))
            ScheduleData[] scheduleDatas = GameMain.Instance.CharacterMgr.status.scheduleSlot;
            Maid           maid;

            // 사용 가능한 메이드 슬롯 목록
            List <int> slots = new();

            for (int i = 0; i < scheduleDatas.Length; i++)
            {
                if (scheduleDatas[i].maid_guid == string.Empty)
                {
                    continue;
                }
                slots.Add(i);
            }


            //var facilitys = GameMain.Instance.FacilityMgr.GetFacilityArray().Where(x=>x).ToList();
            var facilitys = GameMain.Instance.FacilityMgr.GetFacilityArray().ToList();

            if (configEntryUtill["SetFacilityAllMaid"])
            {
                MyLog.LogMessage(
                    "SetFacilityAllMaid3"
                    , scheduleDatas.Length
                    , slots.Count
                    , facilitys.Count
                    );
            }

            // 구현부
            Facility facility;

            FacilityDataTable.FacilityDefaultData defaultData;
            ScheduleCSVData.Work workData;

            while (facilitys.Count > 2)
            {
                int n2 = UnityEngine.Random.Range(2, facilitys.Count);
                if (facilitys[n2] == null)
                {
                    if (configEntryUtill["SetFacilityAllMaid"])
                    {
                        MyLog.LogMessage(
                            "SetFacilityAllMaid null"
                            , n2
                            );
                    }
                }
                else
                {
                    facility    = facilitys[n2];
                    defaultData = facility.defaultData;
                    workData    = defaultData.workData;

                    if (facility.minMaidCount <= slots.Count && workData.id != 0)
                    {
                        for (int k = 0; k < facility.minMaidCount; k++)
                        {
                            int n1 = UnityEngine.Random.Range(0, slots.Count);
                            try
                            {
                                maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(slots[n1]);
                                if (configEntryUtill["SetFacilityAllMaid"])
                                {
                                    MyLog.LogMessage(
                                        "SetFacilityAllMaid4"
                                        , n2
                                        , n1
                                        , MyUtill.GetMaidFullName(maid)
                                        , facility.defaultName

                                        );
                                }

                                //if (ScheduleMgrPatch.m_scheduleApi != null)
                                ScheduleMgrPatch.m_scheduleApi.SetNoonWorkSlot_Safe(scheduleTime, slots[n1], workData.id);

                                facility.AllocationMaid(maid, scheduleTime);
                            }
                            catch (Exception e)
                            {
                                MyLog.LogWarning(
                                    "SetFacilityAllMaid4"
                                    , n2
                                    , e.ToString()
                                    );
                            }
                            slots.Remove(slots[n1]);
                        }
                        if (slots.Count == 0)
                        {
                            if (!DailyMgrPatch.IsLegacy)
                            {
                                GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
                            }
                            ScheduleAPI.MaidWorkIdErrorCheck(true);
                            return;
                        }
                    }
                }
                facilitys.RemoveAt(n2);
            }

            facility    = facilitys[1];
            defaultData = facility.defaultData;
            workData    = defaultData.workData;
            while (slots.Count > 0)
            {
                int n1 = 0;
                maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(slots[n1]);

                //if (ScheduleMgrPatch.m_scheduleApi != null)
                ScheduleMgrPatch.m_scheduleApi.SetNoonWorkSlot_Safe(scheduleTime, slots[n1], workData.id);

                facility.AllocationMaid(maid, scheduleTime);

                slots.RemoveAt(n1);
            }

            if (!DailyMgrPatch.IsLegacy)
            {
                GameMain.Instance.FacilityMgr.UpdateFacilityAssignedMaidData();
            }
            ScheduleAPI.MaidWorkIdErrorCheck(true);
        }