Ejemplo n.º 1
0
        public bool DelYsxx(string itemCode, WorkFlowNode ysType)
        {
            ArrayList sqls = new ArrayList();
            string tmpSql;
            Dictionary<string, string> delCondition = new Dictionary<string, string>();

            delCondition.Clear();
            delCondition.Add("itemcode", itemCode);
            sqls.Add(SqlBuilder.BuildDeleteSql<Xm_Ysxx>(delCondition));

            delCondition.Clear();
            delCondition.Add("itemcode", itemCode);
            delCondition.Add("xh", "1");
            delCondition.Add("stage", ((int)ItemStage.YanShou).ToString());
            sqls.Add(SqlBuilder.BuildDeleteSql<Xm_Gcxx>(delCondition));

            //清空项目所有的文件。
            tmpSql = "delete from item_file where itemcode = '{0}' and nodeid = '{1}'";
            tmpSql = string.Format(tmpSql, itemCode, (int)ysType);
            sqls.Add(tmpSql);

            if (ysType == WorkFlowNode.ChuYan)
            {
                //清空项目所有的文件。
                tmpSql = "delete from item_file where itemcode = '{0}' and nodeid = '{1}' and filecode not in ('24','25','26')";
                tmpSql = string.Format(tmpSql, itemCode, (int)WorkFlowNode.JunGong);
                sqls.Add(tmpSql);
            }

            return OracleHelper.ExecuteCommand(sqls);
        }
Ejemplo n.º 2
0
    public PreferencesManager()
    {
        _terrains = (byte)PlayerPrefs.GetInt(TERRAINS,1);
        _operations = (byte)PlayerPrefs.GetInt(OPERATIONS,15);
        _tileNum = PlayerPrefs.GetInt(TILES,1);
        _eqFormat = PlayerPrefs.GetInt(EQ_FORMAT,0);
        _numWin = PlayerPrefs.GetInt(NUM_WIN,25);
        _alienSpeed = PlayerPrefs.GetFloat(ALIENSPEED ,0.5f);
        _mathiusTexturesInt = PlayerPrefs.GetInt(TEXTUREINT,0);
        _usePerceptual = (PlayerPrefs.GetInt(USEPERCEPTUAL,0).Equals(0)) ? false : true;
        _musicVolume = PlayerPrefs.GetFloat(MUSICVOLUME,0.5f);
        _SFXVolume = PlayerPrefs.GetFloat(SFXVOLUME,0.5f);
        _mute = (PlayerPrefs.GetInt(MUTE,0).Equals(1)) ? true : false;

        _pVolume = new Dictionary<int, float>();
        _pVolume.Clear();
        _pVolume.Add (0,0.0f);
        _pVolume.Add (1,0.5f);
        _pVolume.Add (2,1.0f);

        int state = PlayerPrefs.GetInt(PERCEPTUALVOLUME,0);

        _perceptualVolume = _pVolume[state];
        _pVolumeMode = state;
    }
Ejemplo n.º 3
0
 public SkyBoxManager(Material[] materials)
 {
     _skyboxMap = new Dictionary<string, SkyBoxes> ();
     _skyboxMap.Clear();
     _skyboxes = materials;
     _current = null;
 }
Ejemplo n.º 4
0
 void getUniText()
 {
     Dictionary<string,string> tempDict = new Dictionary<string, string> ();
     var asset = uniText;
     if (asset == null)
         Debug.LogError ("Could not find json unitext file");
     else {
         var jsonString = asset.text;
         var decodedHash = jsonString.hashtableFromJson ();
         if (decodedHash == null)
             Debug.LogError ("Is not json file");
         else {
             var unitext = (IDictionary)decodedHash ["unitext"];
             if (unitext == null)
                 Debug.LogError ("Is not json unitext file");
             else
                 foreach (System.Collections.DictionaryEntry item in unitext) {
                     var lang = (IDictionary)((IDictionary)item.Value);
                     if (lang == null)
                         Debug.LogError ("Is not json unitext file");
                     else if (item.Key.ToString () == currentLang) {
                         tempDict.Clear ();
                         foreach (System.Collections.DictionaryEntry phrase in lang) {
                             tempDict.Add (phrase.Key.ToString (), phrase.Value.ToString ());
                         }
                         uniDict.Add (item.Key.ToString (), tempDict);
                     }
                     //Debug.Log("lang load:"+item.Key.ToString ());
                 }
             asset = null;
             Resources.UnloadUnusedAssets ();
         }
     }
 }
Ejemplo n.º 5
0
        public void TestReplaceTags()
        {
            var tagsCaseSensitive = new Dictionary<string, string>(StringComparer.InvariantCulture);
            tagsCaseSensitive["foo1"] = "bar1";
            tagsCaseSensitive["foo2"] = "bar2";
            tagsCaseSensitive["FOO3"] = "bar3";

            var tagsCaseInsensitive = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
            tagsCaseInsensitive["foo1"] = "bar1";
            tagsCaseInsensitive["foo2"] = "bar2";
            tagsCaseInsensitive["FOO3"] = "bar3";

            string prefix = "$(";
            string suffix = ")";
            string source = "$(foo1) $(foo2) $(foo3) $(foo1)$(foo2)$(foo3)$(foo1)";

            Assert.AreEqual("bar1 bar2 $(foo3) bar1bar2$(foo3)bar1", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseSensitive, TaggedStringOptions.LeaveUnknownTags));
            Assert.AreEqual("bar1 bar2 bar3 bar1bar2bar3bar1", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseInsensitive, TaggedStringOptions.LeaveUnknownTags));
            Assert.AreEqual("bar1 bar2  bar1bar2bar1", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseSensitive, TaggedStringOptions.RemoveUnknownTags));

            tagsCaseInsensitive.Clear();
            tagsCaseInsensitive["salt"] = "salt";
            prefix = "%";
            suffix = "%";
            source = "%salt%%salt%%pepper%%pepper%%salt%%pepper%";

            Assert.AreEqual("saltsaltsalt", StringUtility.ReplaceTags(source, prefix, suffix, tagsCaseInsensitive, TaggedStringOptions.RemoveUnknownTags));
        }
Ejemplo n.º 6
0
    public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Using Dictionary<Int32,Byte> to implemented the clear method");

        try
        {
            IDictionary iDictionary = new Dictionary<Int32,Byte>();
            Int32[] key = new Int32[1000];
            Byte[] value = new Byte[1000];
            for (int i = 0; i < 1000; i++)
            {
                key[i] = i;
            }
            TestLibrary.Generator.GetBytes(-55, value);
            for (int i = 0; i < 1000; i++)
            {
                iDictionary.Add(key[i], value[i]);
            }
            iDictionary.Clear();
            if (iDictionary.Count != 0)
            {
                TestLibrary.TestFramework.LogError("003", "The result is not the value as expected ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 7
0
    static bool LoadTextAsset(TextAsset textAsset, Dictionary<string, string> dic)
    {
        if (textAsset == null || dic == null)
            return false;

        char[] separator1 = new char[] { '\n' };
        char[] separator2 = new char[] { '=' };
        string[] sArr1 = textAsset.text.Split(separator1);

        dic.Clear();

        for (int i=0; i<sArr1.Length; i++) {

            string line = sArr1[i];

            string[] sArr2 = line.Split(separator2);
            if (sArr2.Length < 2)
                continue;

            string akey = sArr2[0].Trim();
            string avalue = sArr2[1].Trim();

            if (!dic.ContainsKey(akey))
                dic.Add(akey, avalue);
            else
                Debug.LogError(string.Format("{0}存在相同的key={1}", textAsset.name, akey) );

        }

        return true;
    }
 internal PnrpResolveScope EnumerateClouds(bool forResolve, Dictionary<uint, string> LinkCloudNames, Dictionary<uint, string> SiteCloudNames)
 {
     bool flag = false;
     PnrpResolveScope none = PnrpResolveScope.None;
     LinkCloudNames.Clear();
     SiteCloudNames.Clear();
     UnsafePnrpNativeMethods.CloudInfo[] clouds = UnsafePnrpNativeMethods.PeerCloudEnumerator.GetClouds();
     if (forResolve)
     {
         foreach (UnsafePnrpNativeMethods.CloudInfo info in clouds)
         {
             if (info.State == UnsafePnrpNativeMethods.PnrpCloudState.Active)
             {
                 if (info.Scope == UnsafePnrpNativeMethods.PnrpScope.Global)
                 {
                     none |= PnrpResolveScope.Global;
                     flag = true;
                 }
                 else if (info.Scope == UnsafePnrpNativeMethods.PnrpScope.LinkLocal)
                 {
                     LinkCloudNames.Add(info.ScopeId, info.Name);
                     none |= PnrpResolveScope.LinkLocal;
                     flag = true;
                 }
                 else if (info.Scope == UnsafePnrpNativeMethods.PnrpScope.SiteLocal)
                 {
                     SiteCloudNames.Add(info.ScopeId, info.Name);
                     none |= PnrpResolveScope.SiteLocal;
                     flag = true;
                 }
             }
         }
     }
     if (!flag)
     {
         foreach (UnsafePnrpNativeMethods.CloudInfo info2 in clouds)
         {
             if (((info2.State != UnsafePnrpNativeMethods.PnrpCloudState.Dead) && (info2.State != UnsafePnrpNativeMethods.PnrpCloudState.Disabled)) && (info2.State != UnsafePnrpNativeMethods.PnrpCloudState.NoNet))
             {
                 if (info2.Scope == UnsafePnrpNativeMethods.PnrpScope.Global)
                 {
                     none |= PnrpResolveScope.Global;
                 }
                 else if (info2.Scope == UnsafePnrpNativeMethods.PnrpScope.LinkLocal)
                 {
                     LinkCloudNames.Add(info2.ScopeId, info2.Name);
                     none |= PnrpResolveScope.LinkLocal;
                 }
                 else if (info2.Scope == UnsafePnrpNativeMethods.PnrpScope.SiteLocal)
                 {
                     SiteCloudNames.Add(info2.ScopeId, info2.Name);
                     none |= PnrpResolveScope.SiteLocal;
                 }
             }
         }
     }
     return none;
 }
 void Start()
 {
     PLAY_ON_GAMEOBJECT = gameObject.transform.position;
     audioVolume = 1.0f;
     audioMapping = new Dictionary<string, AudioClip>();
     audioMapping.Clear();
     foreach(AudioClip ac in sounds){
         audioMapping.Add(ac.name,ac);
     }
 }
Ejemplo n.º 10
0
 public static void FilldcInfTariffInfo(TrudoyomkostDBContext dbcontext, ref Dictionary<InfTariffInfo, double> dcInfTariffInfo)
 {
     var tempResult = from inftariff in dbcontext.InfTariff
                      select inftariff;
     dcInfTariffInfo.Clear();
     foreach (var item in tempResult)
         if (!dcInfTariffInfo.ContainsKey(new InfTariffInfo(item.TariffNetNum, item.KindPay, item.WorkerRate)))
         {
             dcInfTariffInfo.Add(new InfTariffInfo(item.TariffNetNum, item.KindPay, item.WorkerRate), item.HourCost);
         }
 }
Ejemplo n.º 11
0
        private void ClearValidator(Dictionary<Control, ValidatorBase> validators)
        {
            if (validators == null || validators.Count == 0) return;

            foreach (KeyValuePair<Control, ValidatorBase> item in validators)
            {
                item.Key.Validating -= ControlValidating;
            }

            validators.Clear();
        }
Ejemplo n.º 12
0
 void cargarStories(Dictionary<int,UserStory> stories,Dictionary<int,bool> selected)
 {
     stories.Clear();
     selected.Clear();
     ArrayList lista=(ArrayList) MultiPlayer.Instance.getListaSprints();
     Sprint sprint0=(Sprint) lista[0];
     ArrayList listastories=sprint0.getListaStories();
     for(int i=0;i<listastories.Count;i++){
         UserStory user=(UserStory) listastories[i];
      	stories.Add((int)user.getId_UserStory(),user);
         selected.Add((int)user.getId_UserStory(),false);
     }
 }
Ejemplo n.º 13
0
        private Dictionary<UInt32, TempPlayObject> m_DicTempPlayObject = null; //临时角色信息

        #endregion Fields

        #region Constructors

        public UserEngine()
        {
            m_DicPlayerObject = new Dictionary<UInt32, PlayerObject>();
            m_DicPlayerObject.Clear();

            m_DicTempPlayObject = new Dictionary<UInt32, TempPlayObject>();
            m_DicTempPlayObject.Clear();

            mListCacheRole = new List<PlayerObject>();
            mListCacheRole.Clear();
            mListSaveRole = new List<PlayerObject>();
            mnCachePlaySaveTick = System.Environment.TickCount;
        }
Ejemplo n.º 14
0
    public GUIManager(GUISkin skin)
    {
        pointer = "";
        this.skin = skin;
        GUIObjects = new Dictionary<string, GUIProperties>();
        GUIObjects.Clear();
        scrollmap = new Dictionary<string, DirectionScroller>();
        scrollmap.Clear ();

        texture = new Texture2D(1,1); //texture set to red here.
        texture.SetPixel(0,0,Color.red);
        texture.Apply();
    }
    IEnumerator FillUpWithSameComp(int hullID)
    {
        print("Running Test: FillUpWithSameComp");
        Dictionary<int, int> slotVerificationTable = new Dictionary<int, int>();
        MethodInfo AddCompMethod = typeof(ShipDesignSystem).GetMethod("AddCompToDisplay", BindingFlags.NonPublic | BindingFlags.Instance);

        foreach (var compEntry in compTable)
        {
            print("Testing " + compEntry.Value.componentName);
            slotVerificationTable.Clear();
            ShipDesignSystem.Instance.BuildHull(hullID);
            Hull buildingHull = typeof(ShipDesignSystem).GetField("currentHull", BindingFlags.NonPublic | BindingFlags.Instance)
                .GetValue(ShipDesignSystem.Instance) as Hull;

            ShipBlueprint shipBP = typeof(ShipDesignSystem).GetField("currentBlueprint", BindingFlags.Instance | BindingFlags.NonPublic)
                .GetValue(ShipDesignSystem.Instance) as ShipBlueprint;
            foreach (var slotEntry in buildingHull.SlotTable)
            {
                AddCompMethod.Invoke(ShipDesignSystem.Instance, new object[] { slotEntry.Value, compEntry.Value });
                shipBP.AddComponent(compEntry.Value, slotEntry.Value);
                slotVerificationTable.Add(slotEntry.Key, compEntry.Key);
                yield return null;
            }
            StringBuilder sb = new StringBuilder("Test_FillUpWithSameComp_Hull_");
            sb.Append(hullTable[hullID].name);
            sb.Append("_Comp_");
            sb.Append(compEntry.Value.componentName);
            string fileName = sb.ToString();

            ShipDesignSystem.Instance.DeleteBlueprint(fileName);
            ShipDesignSystem.Instance.SaveBlueprint(fileName);
            ShipDesignSystem.Instance.ClearBlueprint();
            yield return new WaitForSeconds(0.2f);
            ShipDesignSystem.Instance.LoadBlueprint(fileName);
            ShipBlueprint loadedBP = typeof(ShipDesignSystem).GetField("currentBlueprint", BindingFlags.Instance | BindingFlags.NonPublic)
                .GetValue(ShipDesignSystem.Instance) as ShipBlueprint;
            yield return new WaitForSeconds(0.2f);
            if (!VerifyLoadedBlueprint(loadedBP, slotVerificationTable, hullID))
            {
                Debug.LogError("Error in Test: FillUpWithSameComp - Loaded blueprint does not match ");
                Debug.Break();
            }
            else
            {
                Debug.Log("Loaded Blueprint matches");
            }
            ShipDesignSystem.Instance.DeleteBlueprint(fileName);
            ShipDesignSystem.Instance.ClearBlueprint();
        }
    }
Ejemplo n.º 16
0
        protected static void LoadNames(bool isFemale)
        {
            Dictionary<string, bool> names = new Dictionary<string, bool>();
            LoadHumanFirstNames(isFemale, names);
            sNames.AddNames(CASAgeGenderFlags.Human, isFemale, names);

            foreach (CASAgeGenderFlags species in new CASAgeGenderFlags[] { CASAgeGenderFlags.Cat, CASAgeGenderFlags.Dog, CASAgeGenderFlags.LittleDog, CASAgeGenderFlags.Horse })
            {
                names.Clear();
                LoadPetFirstNames(isFemale, species, names);
                sNames.AddNames(species, isFemale, names);
            }

            //BooterLogger.AddError(sNames.ToString());
        }
Ejemplo n.º 17
0
	// Use this for initialization
	void Start ()
    {
        this.fsm = new FSM.FSMSystem(this.gameObject);
        List<FSM.FSMState> states = new List<FSM.FSMState>();
        List<FSM.TransitionInfo> trans = new List<FSM.TransitionInfo>();
        Dictionary<FSM.eTransition, FSM.TransitionInfo.eTransitionType> transType = new Dictionary<FSM.eTransition,FSM.TransitionInfo.eTransitionType>();

        trans.Add(new FSM.TransitionInfo(FSM.TransitionInfo.eTransitionType.NoneTransition, FSM.eStateId.Attack, FSM.eTransition.EnemyInTrigger, null));
        transType.Add(FSM.eTransition.EnemyInTrigger, FSM.TransitionInfo.eTransitionType.AddChild);
        states.Add(new FSM.Idle(trans, transType, this.fsm));
        trans.Clear();
        transType.Clear();
        states.Add(new FSM.Attack(trans, transType, this.fsm));
        this.fsm.AddState(states);
        this.fsm.SetState(FSM.eStateId.Idle);
	}
Ejemplo n.º 18
0
        public static void FilldcInfProducts(TrudoyomkostDBContext dbcontext, ref Dictionary<string, short> dicInfProduct)
        {
            var listProducts = from infproducts in dbcontext.InfProducts
                               where infproducts.Mask == 1 //выбор изделий
                               select new
                               {
                                   infproducts.Product,
                                   infproducts.Cipher
                               };

            dicInfProduct.Clear();
            foreach (var item in listProducts)
            {
                dicInfProduct.Add(item.Product, item.Cipher);
            }
        }
Ejemplo n.º 19
0
 public static void FilldcInfProfession(TrudoyomkostDBContext dbcontext, ref Dictionary<string, ShortProfInfo> dcShortInfProf, ref ValidatingComboBox cbinfProf)
 {
     var tempResult = from infprofession in dbcontext.InfProfession
                      select new
                      {
                          infprofession.ProfCode,
                          infprofession.NameKindWork
                      };
     dcShortInfProf.Clear();
     foreach (var item in tempResult)
     {
         string fullInfo = item.ProfCode.ToString() + " " + item.NameKindWork;
         dcShortInfProf.Add(fullInfo, new ShortProfInfo(item.ProfCode, item.NameKindWork));
         cbinfProf.Items.Add(fullInfo);
     }
 }
Ejemplo n.º 20
0
    public static SortedDictionary<int, string> yt(string targetUri)
    {
        CookieContainer cc = new CookieContainer();
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(targetUri);
        req.CookieContainer = cc;
        req.Timeout = 5000;
        req.GetResponse().Close();
        req = (HttpWebRequest)WebRequest.Create("http://www.youtube.com/get_video_info?video_id=" + Regex.Match(targetUri, "(?<=v=)[\\w-]+").Value);
        req.CookieContainer = cc;
        string _info = null;
        System.Net.WebResponse res = req.GetResponse();
        System.IO.StreamReader sr = new System.IO.StreamReader(res.GetResponseStream());
        _info = sr.ReadToEnd();
        sr.Close();
        res.Close();
        Hashtable info = new Hashtable();
        Dictionary<string, string> _tmp = new Dictionary<string, string>();
        SortedDictionary<int, string> fmtmap = new SortedDictionary<int, string>();

        foreach (string item in _info.Split('&'))
        {
            info.Add(item.Split('=')[0], Uri.UnescapeDataString(item.Split('=')[1]));
        }
        if (Convert.ToString(info["status"]) == "fail")
        {
            throw new UnauthorizedAccessException();
        }
        foreach (string item in Convert.ToString(info["url_encoded_fmt_stream_map"]).Split(','))
        {
            foreach (string a in item.Split('&'))
            {
                _tmp.Add(a.Split('=')[0], Uri.UnescapeDataString(a.Split('=')[1]));
            }
            fmtmap.Add(Convert.ToInt32(_tmp["itag"]), (_tmp["url"]) + "&signature=");
            _tmp.Clear();
        }

        req = (HttpWebRequest)WebRequest.Create("http://www.youtube.com/get_video_info?video_id=" + Regex.Match(targetUri, "(?<=v=)\\w+").Value + "&t=" + Convert.ToString(info["token"]));
        req.CookieContainer = cc;
        req.Timeout = 1500;
        req.GetResponse().Close();

        fmtmap[-2] = Convert.ToString(info["title"]);
        fmtmap[-1] = cc.GetCookieHeader(new Uri("http://www.youtube.com"));
        info.Clear();
        return fmtmap;
    }
Ejemplo n.º 21
0
        public void Test3(int arg) {
            Dictionary<string, int> dictionary1 = new Dictionary<string, int>("aaa", 123, "xyz", true);
            string key = "blah";
            int c = dictionary1.Count;

            int c2 = GetData2().Count;

            bool b = dictionary1.ContainsKey("aaa");

            dictionary1.Remove("aaa");
            dictionary1.Remove("Proxy-Connection");
            dictionary1.Remove(key);

            dictionary1.Clear();
            
            string[] keys = dictionary1.Keys;
        }
Ejemplo n.º 22
0
		public static int FindMaxPoints(Point[] points)
		{
			Dictionary<float, int> dic = new Dictionary<float, int> ();
			int MaxNum = 0;
			int duplicate;
			for (int i = 0; i < points.Length; i++) {
				dic.Clear (); //clear dic each time
				duplicate = 1; //reset duplicate flag
				for (int j = 0; j < points.Length; j++) {
					if (i == j) { //skip the point itself
						continue;
					}
					//handle duplicate
					if (points [i].x == points [j].x && points [i].y == points [j].y) {
						duplicate++;
						continue;
					}

					//handle non-duplicate points
					float key = (points [j].x - points [i].x == 0) ? int.MaxValue : //handle vertical line
						(float)(points [j].y - points [i].y) / (points [j].x - points [i].x);

					if (dic.ContainsKey (key))
						dic [key] += 1;
					else {
						dic.Add (key, 1);
					}
				}

				//if only one point in the array or all points are duplicate, dic 
				//will contain no pair, but the output should be 1 or more, because if all points
				//are the same they still at the same line. so we need to handle this case!!
				if (dic.Count == 0) {
					if (duplicate > MaxNum)
						MaxNum = duplicate;
					continue;
				}

				//Shows How to iterate an unordered data strucutre
				foreach (KeyValuePair<float,int> kp in dic) { //remember use KeyValuePair<>
					if (kp.Value + duplicate > MaxNum)
						MaxNum = kp.Value + duplicate;
				}
			}
			return MaxNum;
		}
Ejemplo n.º 23
0
    public void OnGUI()
    {
        if (!started)
                        return;
                if (!loadIndex) {
                        Command cmd = new Command ("user", "getInfo", new Dictionary<string,object> ());
                        SlgDispatcher dispatcher = SlgDispatcher.Instance;
                        dispatcher.send (cmd);
                        Command cmd2 = new Command ("role", "userRoleList", new Dictionary<string,object> ());
                        dispatcher.send (cmd2);
                        loadIndex = true;

                        Dictionary<string,object> dic = new Dictionary<string,object> ();
                        dic.Add ("type", "weapon");
                        cmd = new Command ("equip", "noUsedEquipList", dic);
                        dispatcher.send (cmd);

                        dic.Clear ();
                        dic = new Dictionary<string,object> ();
                        dic.Add ("type", "armor");
                        cmd = new Command ("equip", "noUsedEquipList", dic);
                        dispatcher.send (cmd);

                        dic.Clear ();
                        dic = new Dictionary<string,object> ();
                        dic.Add ("type", "accessory");
                        cmd = new Command ("equip", "noUsedEquipList", dic);
                        dispatcher.send (cmd);
                }

                if (user != null) {
                        // show user info
                        GUI.Label (new Rect (20, 20, 80, 20), "id:" + user.id);
                        GUI.Label (new Rect (20, 40, 80, 20), "粮食:" + user.food);
                        GUI.Label (new Rect (20, 60, 80, 20), "元宝:" + user.cash);
                        GUI.Label (new Rect (20, 80, 80, 20), "当前经验:" + user.xp);
                        GUI.Label (new Rect (20, 100, 80, 20), "金币:" + user.gold);
                        GUI.Label (new Rect (20, 120, 80, 20), "战斗力:" + user.fightForce);
                        GUI.Label (new Rect (20, 140, 80, 20), "等级:" + user.level);
                        GUI.Label (new Rect (20, 160, 80, 20), "名称:" + user.name);

                        CreateFunctionalButton ();

                }
    }
Ejemplo n.º 24
0
        //selectProd шифр изделия
        public static void FilldcDetNumForProduct(ref Dictionary<string, int> dcIDDetNum, int selectProd)
        {
            var detnumInDb = (from infdet in FillTrudoyomkostDB.infDetList
                              join whereUse in FillTrudoyomkostDB.whereUseList on infdet.ID equals whereUse.InfDetID
                              where whereUse.InfProductsCipher == selectProd && infdet.Available == true && infdet.IndicOSPK != 1 && infdet.SignIrregDet != "Н"
                              select new
                              {
                                  infdet.DetNum,
                                  infdet.ID
                              }).Distinct();

            dcIDDetNum.Clear();

            foreach (var item in detnumInDb)
            {
                dcIDDetNum.Add(item.DetNum, item.ID);
            }
        }
Ejemplo n.º 25
0
		private static void WriteToLogFile()
		{
			while (true)
			{
				try
				{
					Dictionary<string, StringBuilder> dictionary = new Dictionary<string, StringBuilder>();
					while (Writer.logQueue.Count > 0)
					{
						LogMessage logMessage = null;
						lock (Writer.logQueue.SyncRoot)
						{
							if (Writer.logQueue.Count > 0)
							{
								logMessage = (LogMessage)Writer.logQueue.Dequeue();
							}
						}
						if (logMessage != null)
						{
							if (dictionary.ContainsKey(logMessage.location))
							{
								dictionary[logMessage.location].Append(logMessage.message);
							}
							else
							{
								dictionary.Add(logMessage.location, new StringBuilder(logMessage.message));
							}
						}
					}
					foreach (KeyValuePair<string, StringBuilder> current in dictionary)
					{
						Writer.WriteFileContent(current.Value.ToString(), current.Key);
					}
					dictionary.Clear();
				}
				catch (Exception ex)
				{
					Console.WriteLine("Error in console writer: " + ex.ToString());
				}
				Thread.Sleep(3000);
			}
		}
Ejemplo n.º 26
0
 /// <summary>
 /// 生成微信公众号 jsapi_ticket
 /// </summary>
 /// <param name="appId">微;\信公众号应用唯一标识</param>
 /// <param name="appSecret">微信公众号应用密钥(注意保密)</param>
 /// <returns>Ticket</returns>
 public static string GetJsApiTicket(string appId, string appSecret)
 {
     var data = new Dictionary<string, string>
     {
         {"appid", appId},
         {"secret", appSecret},
         {"grant_type", "client_credential"}
     };
     var queryString = HttpBuildQuery(data);
     var accessTokenUrl = "https://api.weixin.qq.com/cgi-bin/token?" + queryString;
     var resp = GetRequest(accessTokenUrl);
     var jObject = JObject.Parse(resp);
     data.Clear();
     data.Add("access_token", jObject.GetValue("access_token").ToString());
     data.Add("type", "jsapi");
     queryString = HttpBuildQuery(data);
     var jsapiTicketUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?" + queryString;
     resp = GetRequest(jsapiTicketUrl);
     var ticket = JObject.Parse(resp);
     return ticket.GetValue("ticket").ToString();
 }
Ejemplo n.º 27
0
 public static void ReadTemplate(string FilePath, string pattern, Dictionary<string, ParamValue> parameters, ArrayList lines)
 {
     parameters.Clear();
     lines.Clear();
     if (File.Exists(FilePath))
     {
         using (StreamReader streamReader = new StreamReader(FilePath))
         {
             string line;
             while ((line = streamReader.ReadLine()) != null)
             {
                 foreach (Match match in Regex.Matches(line, pattern))
                 {
                     if (!parameters.ContainsKey(match.Value))
                         parameters.Add(match.Value, new ParamValue(match.Value));
                 }
                 lines.Add(line);
             }
         }
     }
 }
Ejemplo n.º 28
0
    public Dictionary<string, PlayerLine> GetAnswers(string alist)
    {
        Dictionary<string, PlayerLine> choices;	// Player lines
        choices = new Dictionary<string, PlayerLine> ();

        var answers= alist.Split(' ');
        XmlNodeList answlist = doc.SelectNodes ("dialog/answer");
        int count = 0;
        choices.Clear ();
        foreach (XmlNode answnode in answlist) {
            //Debug.Log("Checking "+answnode.Attributes.GetNamedItem("id").Value);
            foreach (string answer in answers){
                //is this one of the answers Im loking for?
                if (answnode.Attributes.GetNamedItem("id").Value==answer) {
                    //Debug.Log("Found answer "+answer);
                    PlayerLine l = new PlayerLine();
                    var anschoices = answnode.ChildNodes;
                    foreach (XmlNode cnode in anschoices) {
                        if (cnode.Name== "option") { //it is text
                            l.text = cnode.InnerText;
                            l.link = cnode.Attributes.GetNamedItem("link").Value;
                        } else if (cnode.Name== "action") { //action description
                            Action a = new Action();
                            a.ActionType = cnode.Attributes.GetNamedItem("type").Value;
                            a.id = cnode.Attributes.GetNamedItem("id").Value;
                            a.value = cnode.Attributes.GetNamedItem("value").Value;
                            l.actions.Add(a);
                        }
                    }
                    //Debug.Log("answer text is "+anschoices.Item(0).InnerText);

                    choices.Add(answnode.Attributes.GetNamedItem("id").Value, l);
                    //choicelinks.Add(count,anschoices.Item(0).Attributes.GetNamedItem("link").Value);
                    //count++;
                    break;
                }//if
            }//for each answer
        } //foreach answer list
        return choices;
    }
Ejemplo n.º 29
0
    public bool PosTest1()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest1: Using Dictionary<string,Byte> to implemented the clear method");

        try
        {
            IDictionary iDictionary = new Dictionary<string,Byte>();
            string[] key = new string[1000];
            Byte[] value = new Byte[1000];
            for (int i = 0; i < 1000; i++)
            {
                key[i] = TestLibrary.Generator.GetString(-55, false, 1, 100);
            }
            TestLibrary.Generator.GetBytes(-55, value);
            for (int i = 0; i < 1000; i++)
            {
                while (iDictionary.Contains(key[i]))
                {
                    key[i] = TestLibrary.Generator.GetString(false, 1, 100);
                }
                iDictionary.Add(key[i], value[i]);
            }
            iDictionary.Clear();
            if (iDictionary.Count != 0)
            {
                TestLibrary.TestFramework.LogError("001", "The result is not the value as expected ");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
            retVal = false;
        }

        return retVal;
    }
Ejemplo n.º 30
0
        // Use this for initialization
        void Start()
        {
            //Debug.Log(Screen.width + "/" + Screen.height);
            pointerList = new Dictionary<int, GameObject>();
            LogInputField.text = "Start!";
            ClearButton.onClick.AddListener(() => {
                Debug.Log("hoge");
                LogInputField.text = "";//Input.touchCount.ToString();
                //foreach (GameObject in pointerList.Values)

                foreach (GameObject go in pointerList.Values)
                {
                    Destroy(go);
                }
                pointerList.Clear();
            });

            float scaleX = 2048 / Screen.width;
            float scaleY = 1536 / Screen.height;
            scale = scaleY;

            Debug.Log(canvas.transform.localScale);
        }