Exemplo n.º 1
0
    public void Show(string str)
    {
        print("Game info show...\n");
        gameObject.SetActive(true);

        int gameId;

        if (int.TryParse(str, out gameId))
        {
            cfgGameList = CfgCenter.Inst.m_cfgGameListMgr.FindById(gameId);

            m_title.text = cfgGameList._name;
            m_desc.text  = cfgGameList._desc;
            string iconPath = GameConst.UI_Icon_Path + cfgGameList._icon + ".png";
            m_icon.sprite = Assist.LoadSprite(iconPath, (int)m_icon.sprite.rect.width, (int)m_icon.sprite.rect.height).toSprite();
            string screenShotPath = GameConst.UI_ScreenShot_Path + cfgGameList._screenShot + ".png";
            m_screenShot.sprite = Assist.LoadSprite(screenShotPath, (int)m_screenShot.sprite.rect.width, (int)m_screenShot.sprite.rect.height).toSprite();
            m_type.text         = cfgGameList._type;
            m_type.text         = m_type.text.Replace("\\n", "\n");

            for (int i = 0; i < m_typeWordEffectScript.Count; i++)
            {
                m_typeWordEffectScript[i].PlayTypeWordEffect();
            }
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// execute task
        /// </summary>
        public static void ExecuteTask(Tasks task)
        {
            try
            {
                AssistProcessor assist        = new AssistProcessor();
                Assist          serviceAssist = new Assist();

                string planState = serviceAssist.CheckSubscriptionPlanAvailability(task.UserId);
                if (planState != "OK")
                {
                    serviceAssist.AddErrorToDocuments(task.Id, planState);
                    //update task
                    serviceAssist.UpdateTaskState(task.Id, 4);
                    //update documents
                    serviceAssist.UpdateDocumentStatesByTaskId(task.Id, 4);
                    return;
                }

                string url      = serviceAssist.GetSettingValueByName("ApiUrl");
                string json     = task.ProfileContent;
                string error    = "";
                string response = assist.MakeOcr(url, json, ref error);
                if (string.IsNullOrEmpty(response))
                {
                    LogHelper.AddLog(error);
                    serviceAssist.AddErrorToDocuments(task.Id, error);
                    serviceAssist.UpdateDocumentStatesByTaskId(task.Id, 4);
                    serviceAssist.UpdateTaskState(task.Id, 4);
                    return;
                }

                OcrResponseModel model = new OcrResponseModel();
                serviceAssist.UpdateTaskReponseContent(task.Id, response);
                model = JsonConvert.DeserializeObject <OcrResponseModel>(response);

                if (model.Status.Equals("Submitted"))
                {
                    serviceAssist.UpdateTaskState(task.Id, 2);
                    serviceAssist.UpdateDocumentStatesByTaskId(task.Id, 2);
                }
                else
                {
                    string errorText = "";
                    foreach (var ocrError in model.Errors)
                    {
                        errorText += ocrError.ErrorName + ": " + ocrError.ErrorMessage;
                    }
                    serviceAssist.AddErrorToDocuments(task.Id, errorText);
                    serviceAssist.UpdateTaskState(task.Id, 4);
                    serviceAssist.UpdateDocumentStatesByTaskId(task.Id, 4);
                }
            }
            catch (Exception exception)
            {
                string innerException = exception.InnerException == null ? "" : exception.InnerException.Message;
                string methodName     = System.Reflection.MethodBase.GetCurrentMethod().Name;
                LogHelper.AddLog("Error in method: " + methodName + "; Exception: " + exception.Message + " Innner Exception: " +
                                 innerException);
            }
        }
Exemplo n.º 3
0
        public void SetValue(XmlAttributeCollection inValue)
        {
            constructList.Add(new ConstructItem());

            // 构造函数
            ConstructItem construct = new ConstructItem(new List <string>()
            {
                "System.String"
            });

            construct.Struct.Statements.Add(Line("string[] ss", "inArg0.Split(\'^\')"));

            classer.CustomAttributes.Add(new CodeAttributeDeclaration("ProtoContract"));
            for (int i = 0; i < inValue.Count; i++)
            {
                fieldList.Add(new FieldItem(inValue[i].Name, inValue[i].Value, MemberAttributes.Private));

                PropertyItem item = new PropertyItem(inValue[i].Name);
                item.SetGetName();
                item.SetSetName();
                item.SetValueType(inValue[i].Value);
                item.SetModifier(MemberAttributes.Public | MemberAttributes.Final);
                item.SetField("ProtoMember", (i + 1).ToString());
                propertyList.Add(item);

                Type t = (Type)Assist.stringToType(inValue[i].Value);

                string right = t == typeof(System.String) ? "ss[" + i + "]" :
                               t == typeof(System.UInt32) ? "uint.Parse(ss[" + i + "])" :
                               t == typeof(System.Single) ? "float.Parse(ss[" + i + "])" : "new " + t.ToString() + "(inValues[" + i + "])";
                construct.Struct.Statements.Add(Line("_" + Assist.FirstLetterLower(inValue[i].Name), right));
            }
            constructList.Add(construct);
            Create();
        }
Exemplo n.º 4
0
        private MatchEvent GetMatchEvent(MatchEvents type, Player player, Team team)
        {
            MatchEvent matchEvent;

            switch (type)
            {
            case MatchEvents.RedCard:
                matchEvent = new RedCard(player.Id, Match.Id);
                break;

            case MatchEvents.YellowCard:
                matchEvent = new YellowCard(player.Id, Match.Id);
                break;

            case MatchEvents.Assist:
                matchEvent = new Assist(player.Id, Match.Id);
                break;

            case MatchEvents.Goal:
                matchEvent = new Goal(player.Id, team.Id, Match.Id);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(matchEvent);
        }
Exemplo n.º 5
0
        public void SetValue(Dictionary <string, string[]> inDic)
        {
            usingList.Add("ProtoBuf");
            usingList.Add("System.Collections.Generic");

            classer.CustomAttributes.Add(new CodeAttributeDeclaration("ProtoContract"));

            List <string> classnames = new List <string>();
            List <string> classexpla = new List <string>();
            List <string> classType  = new List <string>();

            foreach (KeyValuePair <string, string[]> item in inDic)
            {
                classnames.Add(item.Key);
                classexpla.Add(item.Value[0]);
                classType.Add(item.Value[1]);
            }

            string strType;

            for (int i = 0; i < classnames.Count; i++)
            {
                strType = classType[i];
                string    classname = Assist.FirstLetterUp(classnames[i]);
                FieldItem field     = new FieldItem("Dictionary<" + strType + ",Cfg" + classname + ">", classname + "Dic", "new " + "Dictionary<" + strType + ",Cfg" + classname + ">()");
                field.SetAttributes(MemberAttributes.Final | MemberAttributes.Public);
                field.AddAttributes("ProtoMember", i + 1);
                fieldList.Add(field);

                SetComment(classexpla[i], field.Field);
            }
            Create();
        }
Exemplo n.º 6
0
    /// <summary>
    /// Excel2DataSet
    /// </summary>
    static public DataSet ExcelToDataSet(string path)
    {
        DataSet         ds   = new DataSet();
        OleDbConnection conn = new OleDbConnection();

        try
        {
            //HDR=Yes/NO 表示是否将首行做标题,若设了YES 数据集中自动忽略了第一行。 IMEX 表示是否强制转换为文本

            //string sql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+path+";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1;\"";//2003版

            string sql = "Provider=Microsoft.Ace.OleDb.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=No;IMEX=1;\"";//2007版
            conn.ConnectionString = sql;
            conn.Open();
            DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
            //string tableName = dt.Rows[0][2].ToString().Trim();//获得第一张工作区间表名
            //OleDbCommand cmd = new OleDbCommand("select * from  [" + tableName + "]", conn);//工作表名就是Excel显示区下面的工作区名
            OleDbCommand     cmd = new OleDbCommand("select * from [Sheet1$]", conn);
            OleDbDataAdapter da  = new OleDbDataAdapter(cmd);   //读取Excel表格
            da.Fill(ds);
        }
        catch (Exception ex)
        {
            Assist.Log(ex.StackTrace);
        }

        return(ds);
    }
Exemplo n.º 7
0
    public void ShowGameIcons(Action done)
    {
        this.gameObject.SetActive(true);

        ArrayList al = Assist.Tile(new Vector3(-216, -230, 0), itemList.Count, 3, 250, 80);

        for (int j = 0; j < itemList.Count; j++)
        {
            itemList[j].Self.SetActive(false);
        }
        itemList[0].Self.SetActive(true); //
        // TODO: 动画
        for (int i = 0; i < itemList.Count; i++)
        {
            RectTransform tempRectTrans = itemList[i].Self.GetComponent <RectTransform>();
            Vector3       startPos      = new Vector3(((Vector3)al[i]).x, (((Vector3)al[i]).z - 222) * -1 - 300, 0);
            tempRectTrans.anchoredPosition3D = startPos;
            GameObject next = null;
            if (i <= itemList.Count - 2)
            {
                next = itemList[i + 1].Self;
            }
            tempRectTrans.Moveto(new Vector3(startPos.x, startPos.y + 300, startPos.z), 0.3f).setDelay(0.1f * (i + 1)).setEase(LeanTweenType.easeInCubic).onComplete = () =>
            {
                if (next != null)
                {
                    next.SetActive(true);
                }
            };
        }
    }
Exemplo n.º 8
0
        public void AddAssistToGame(Guid gameId, Guid playerId, int matchMinute)
        {
            var game   = this.FindById(gameId);
            var assist = new Assist(new MatchMinute(matchMinute), DomainService.FindPlayerById(playerId).TeamId, playerId);

            game.Protocol.Assists.Add(assist);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 特性声明
 /// <para>eg. [Serializable]</para>
 /// </summary>
 /// <param name="inName">特性名</param>
 /// <param name="inValue">特性值</param>
 public void SetField(string inName, string inValue)
 {
     if (Assist.IsNumber(inValue))
     {
         property.CustomAttributes.Add(new CodeAttributeDeclaration(inName, new CodeAttributeArgument(new CodePrimitiveExpression(int.Parse(inValue)))));
     }
 }
Exemplo n.º 10
0
 public PropertyItem(string inName)
 {
     property        = new CodeMemberProperty();
     property.HasGet = false;
     property.HasSet = false;
     property.Name   = Assist.FirstLetterLower(inName);
 }
Exemplo n.º 11
0
        private ICollection <Play> FieldGoalTwoActions(ICollection <PlayDTO> playsBundle)
        {
            var  dto1    = playsBundle.First();
            var  dto2    = playsBundle.Last();
            bool _FGmade = dto1.MainBoolProperty;
            var  fg      = new FieldGoal(Guid.NewGuid(), DateTime.Now, dto1.IsTeamB, dto1.PlayerId, _gameId, dto1.Points, _FGmade, dto2.PlayType.ToLower() == "block", _FGmade);

            if (dto2.PlayType.ToLower() == "assist")
            {
                var assist = new Assist(Guid.NewGuid(), DateTime.Now, dto1.IsTeamB, dto2.PlayerId, _gameId, fg);
                return(new List <Play> {
                    fg, assist
                });
            }
            if (playsBundle.Last().PlayType.ToLower() == "rebound")
            {
                var rebound = new Rebound(Guid.NewGuid(), DateTime.Now, dto2.IsTeamB, dto2.PlayerId, _gameId, dto1.IsTeamB == dto2.IsTeamB, fg);
                return(new List <Play> {
                    fg, rebound
                });
            }
            if (playsBundle.Last().PlayType.ToLower() == "block")
            {
                var block = new Block(Guid.NewGuid(), DateTime.Now, dto2.IsTeamB, dto2.PlayerId, _gameId, fg);
                return(new List <Play> {
                    fg, block
                });
            }
            throw new InvalidDataException();
        }
Exemplo n.º 12
0
    private void StartExternalApp()
    {
        if (GlobalData.m_isFirstEntered)
        {
            PlayTimeMgr.Inst.StartRecord();
            GlobalData.m_isFirstEntered = false;
        }

        // StartHookWindows();
        RecordMgr.Inst.StartRecord(cfgGameList);
        string relativePath = cfgGameList._relativePath;
        string _appPath     = GlobalData.AppContentPath() + relativePath;

        Debug.Log("_appPath:" + _appPath);
        VRSettings.enabled = false;
        Assist.StartExternalApp(_appPath, () =>
        {
            VRSettings.enabled = true;
            RecordMgr.Inst.StopRecord(cfgGameList);
            // HookProcess.Kill();
            ActiveMainWindow("BlackHole");
            TimerManager.Add(1, (x) => { Camera.main.gameObject.GetComponent <RestVRState>().Rest(); });
            isOpening = false;
        });
    }
Exemplo n.º 13
0
 public Console()
 {
     invalidState = true;
     messages     = new List <string>();
     consolePanel = Assist.LoadUI(UI_PREFAB);
     inputField   = Assist.FindComponent <InputField>(consolePanel, UI_INPUT_FIELD);
     textField    = Assist.FindComponent <Text>(consolePanel, UI_TEXT_OUTPUT);
 }
Exemplo n.º 14
0
 public Base(string inSpace, string inClassName, string inFolderName)
 {
     spaceName       = inSpace.Trim();
     className       = inClassName;
     folderName      = inFolderName;
     classer         = new CodeTypeDeclaration(Assist.FirstLetterUp(inClassName));
     classer.IsClass = true;
 }
Exemplo n.º 15
0
 private void Awake()
 {
     Instance = this;
     DontDestroyOnLoad(this);
     configPath = Application.dataPath + "/config.dat";
     adLogoPath = Application.dataPath + "/ADLogo/AdLogo.png";
     loadSprite = GetAdLogoSprite();
 }
Exemplo n.º 16
0
        public void SetData( )
        {
            id        = 1;
            name.text = "大雄宝殿";
            string iconPath = GameConst.UI_Icon_Path + "Icon_DaXiongBaoDian.png";

            icon.sprite = Assist.LoadSprite(iconPath, (int)icon.sprite.rect.width, (int)icon.sprite.rect.height).toSprite();
            Self.SetActive(false);
        }
Exemplo n.º 17
0
        public void SetData(CfgGameList cfgGameList)
        {
            id        = cfgGameList._id;
            name.text = cfgGameList._name;
            //Self.name =cfgGameList._id.ToString();
            string iconPath = GameConst.UI_Icon_Path + cfgGameList._icon + ".png";

            icon.sprite = Assist.LoadSprite(iconPath, (int)icon.sprite.rect.width, (int)icon.sprite.rect.height).toSprite();
            Self.SetActive(false);
        }
Exemplo n.º 18
0
 private static void stopAssist()
 {
     if (Assist.engine != null)
     {
         Assist.engine.StopEngine();
         Assist.Dispose();
         AssistContainer.reset();
         clientConnect.Stop();
     }
 }
Exemplo n.º 19
0
        private dynamic GetScript(string script_path)
        {
            var assist        = new Assist();
            var script_engine = Python.CreateEngine();
            var script_scope  = script_engine.CreateScope();

            script_scope.SetVariable("assist", assist);
            dynamic script = script_engine.ExecuteFile(script_path, script_scope);

            return(script);
        }
Exemplo n.º 20
0
 internal static bool AreEqual(Assist p1, Assist p2)
 {
     if (AreEqual((Play)p1, (Play)p2))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// 将 .proto 文件转成 .cs 文件
        /// <para>用于项目非ProtoBuf-net类型协议,以后用PB协议的话这里就没有用了</para>
        /// </summary>
        /// <param name="inPath"></param>
        /// <param name="inFolderName"></param>
        /// <returns></returns>
        public bool Proto2CSharp(string inPath, string inFolderName)
        {
            Assist.CheckFolderExist(inFolderName);
            Assist.DeleteFilesInFolder("ProtoItem");

            Assist.GetObjPaths(".proto", inPath).ForEach(delegate(string path)
            {
                FileInfo targetFileInfo = new FileInfo(path);
                bool bCommonClass       = path.EndsWith("_comm.proto");

                // 类名 -> 成员列表<成员名, 成员类型>
                Dictionary <string, Dictionary <string, string> > nClasses = null;
                if (targetFileInfo != null)
                {
                    Queue <string> sq = new Queue <string>();
                    StreamReader sr   = new StreamReader(path, System.Text.Encoding.Default);
                    string line;
                    while (!sr.EndOfStream)
                    {
                        line = sr.ReadLine().Trim();
                        line = Regex.Replace(line, @"/{2}.+", "");// 去掉“//”行
                        line = Regex.Replace(line, @"{\s*", "");
                        sq.Enqueue(line);
                    }
                    sr.Close();
                    sr.Dispose();

                    string curNameSpace = sq.Dequeue().Remove(0, 8).Replace(";", "");

                    nClasses = HanldQueue(sq);

                    foreach (KeyValuePair <string, Dictionary <string, string> > fieldStr in nClasses)
                    {
                        if (fieldStr.Key != "")
                        {
                            ProtoToCSharp ptcs = new ProtoToCSharp(curNameSpace, fieldStr.Key, "ProtoItem");
                            try
                            {
                                ptcs.Create(fieldStr.Value, bCommonClass);
                            }
                            catch (Exception exp)
                            {
                                throw new Exception(exp.ToString() + ", Class" + fieldStr);
                            }
                        }
                    }
                }
                if (bCommonClass)
                {
                    AutoCSharp.Do.Creator.TypeMapper.InitProtoAssembly();
                }
            });
            return(true);
        }
Exemplo n.º 22
0
        public AssistTests()
        {
            var player = new Player(new Name("Arne", "Anka"), new DateOfBirth("1985-05-20"),
                                    PlayerPosition.Midfielder, PlayerStatus.Available);
            var playerTwo = new Player(new Name("Arne", "Anka"), new DateOfBirth("1985-05-20"),
                                       PlayerPosition.Midfielder, PlayerStatus.Available);

            this.assistOne   = new Assist(new MatchMinute(30), Guid.Empty, player.Id);
            this.assistTwo   = new Assist(new MatchMinute(30), Guid.Empty, player.Id);
            this.assistThree = new Assist(new MatchMinute(31), Guid.Empty, player.Id);
        }
Exemplo n.º 23
0
    int typeIndex         = 2; //第三行:是类型

    public void Gen()
    {
        string currDir = Environment.CurrentDirectory;

        this.m_inPath = Path.Combine(currDir, m_inPath);
        Assist.CreateDir(this.m_inPath);

        this.m_outPath = Path.Combine(currDir, m_outPath);
        Assist.CreateDir(this.m_outPath);

        ForGen(m_inPath, m_outPath);
    }
Exemplo n.º 24
0
        /// <summary>
        /// ------------------- TODO -------------------
        /// </summary>
        /// <returns></returns>
        public bool ExcelToXml(string inPath, string inFolderName)
        {
            Assist.CheckFolderExist(inFolderName);
            Assist.GetObjPaths(".xls", inPath).ForEach(delegate(string path)
            {
                DataSet ds   = Assist.ExcelToData(path);
                DataTable dt = ds.Tables[0];

                //ExcelToXml e = new ExcelToXml();
            });
            return(true);
        }
        public ViewControllerCreateAccount()
        {
            panelView = Assist.LoadUI(PANEL_PREFAB_PATH);
            visible   = false;

            email        = Assist.FindComponent <InputField>(panelView, "email");
            password     = Assist.FindComponent <InputField>(panelView, "password");
            createButton = Assist.FindComponent <Button>(panelView, "create_button");

            createButton.onClick = new Button.ButtonClickedEvent();
            createButton.onClick.AddListener(this.OnCreateButtonPressed);
        }
Exemplo n.º 26
0
 public static async Task Main(string[] args)
 {
     try
     {
         ReflectionHelper.Instance.GatherExtraNativeAssemblies();
         CreateHostBuilder(args).Build().Run();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Failed to start: " + Assist.PrintException(ex));
     }
 }
Exemplo n.º 27
0
        public ViewControllerLogin()
        {
            panelView = Assist.LoadUI(PANEL_PREFAB_PATH);
            visible   = false;

            userInputField     = Assist.FindComponent <InputField>(panelView, "user_input");
            passwordInputField = Assist.FindComponent <InputField>(panelView, "password_input");
            loginButton        = Assist.FindComponent <Button>(panelView, "login_button");

            loginButton.onClick = new Button.ButtonClickedEvent();
            loginButton.onClick.AddListener(this.OnLoginButtonPressed);
        }
Exemplo n.º 28
0
        private static void startAssist()
        {
            if (Assist.engine == null)
            {
                bool success = Assist.Init();

                if (success == true)
                {
                    clientConnect.Start();
                    Assist.engine.StartEngine(Assist.name);
                }
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// 将指定目录下的xml转成cs文件
        /// </summary>
        /// <param name="inPath">xml所在路径</param>
        /// <param name="inFolderName">根节点名</param>
        /// <param name="inNameSpace">命名空间</param>
        /// <param name="inHeritNames">继承</param>
        /// <returns></returns>
        public bool Xml2CS(string inPath, string inFolderName, string inRootName, string inNameSpace, string inHeritNames)
        {
            Assist.CheckFolderExist(inFolderName);

            Dictionary <string, XmlDocument> doc = Assist.GetXml(inPath);

            foreach (KeyValuePair <string, XmlDocument> item in doc)
            {
                XmlUnit b = new XmlUnit(inNameSpace, item.Key, inFolderName);
                b.SetInherit(inHeritNames);
                b.SetNodeValue(item.Value.SelectSingleNode(inRootName).ChildNodes[0]);
            }
            return(true);
        }
Exemplo n.º 30
0
 /// <summary>
 /// 字段
 /// <para>eg. public Dictionary<string,string> TestDic = new Dictionary<string,string>();</para>
 /// </summary>
 /// <param name="inLeft">字段类型</param>
 /// <param name="inFieldName"></param>
 /// <param name="inRight"></param>
 public FieldItem(string inLeft, string inFieldName, string inRight = "", MemberAttributes inAtt = MemberAttributes.Private)
 {
     inLeft = Assist.GetFieldType(inLeft);
     if (inLeft.Contains("SMGame."))
     {
         inLeft = inLeft.Replace("SMGame.", "");
     }
     field = new CodeMemberField(inLeft, inFieldName);
     if (inRight != "")
     {
         CodeVariableReferenceExpression right = new CodeVariableReferenceExpression(inRight);
         field.InitExpression = right;
     }
     field.Attributes = inAtt;
 }